44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
# Learn PyTorch
|
|
|
|
> [!Important]
|
|
> Steps here to run PyTorch locally are specific to machines with Intel XPUs.
|
|
|
|
Experimenting with PyTorch using Intel architecture (i.e., Intel Core Ultra processor with iGPU).
|
|
|
|
After installing `ipex-llm` which is required to use Intel GPUs (see [Setup](#setup)), you will have access to `conda` and be able to `import torch` normally.
|
|
|
|
The XPU is an accelerator for working with Tensors.
|
|
|
|
## Setup
|
|
|
|
1. [Install IPEX-LLM on Intel GPU with PyTorch 2.6](https://git.ayo.run/ayo/ipex-llm/src/branch/main/docs/mddocs/Quickstart/install_pytorch26_gpu.md)
|
|
|
|
2. Clone repo
|
|
|
|
```bash
|
|
$ git clone https://git.ayo.run/ayo/learn-pytorch
|
|
```
|
|
|
|
3. Run `env.sh` to activate the conda environment and set
|
|
|
|
```bash
|
|
$ cd learn-python
|
|
$ . env.sh
|
|
```
|
|
|
|
4. (Optional) Confirm if XPU is detected
|
|
|
|
```bash
|
|
$ python # go intou the python shell
|
|
|
|
$ import torch
|
|
$ torch.xpu.is_available()
|
|
$ torch.xpu.get_device_name()
|
|
|
|
```
|
|
|
|
## Links
|
|
|
|
- [Get started with PyTorch locally](https://pytorch.org/get-started/locally/)
|
|
- [Getting started with Tensors](https://docs.pytorch.org/tutorials/beginner/basics/tensorqs_tutorial.html)
|
|
- [torch operations](https://docs.pytorch.org/docs/stable/torch.html)
|