File tree Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ # PyTorch ROCm gfx803
2
+
3
+ build pytorch 1.x with ROCm support for stable-diffusion-webui
4
+
5
+ ```
6
+ Ubuntu 22.04.2 LTS
7
+ Radeon RX 580 8GB
8
+ RoCm 5.4.3
9
+
10
+ Python 3.10.6
11
+ - pytorch 1.13.1
12
+ - torchvision 0.14.1
13
+ ```
14
+
15
+ ## Install ROCm
16
+
17
+ ``` bash
18
+ sudo echo ROC_ENABLE_PRE_VEGA=1 >> /etc/environment
19
+ sudo echo HSA_OVERRIDE_GFX_VERSION=8.0.3 >> /etc/environment
20
+ # reboot
21
+
22
+ wget https://repo.radeon.com/amdgpu-install/22.40.3/ubuntu/focal/amdgpu-install_5.4.50403-1_all.deb
23
+ sudo apt install ./amdgpu-install_5.4.50403-1_all.deb
24
+ sudo amdgpu-install -y --usecase=rocm,hiplibsdk,mlsdk
25
+
26
+ sudo usermod -aG video $LOGNAME
27
+ sudo usermod -aG render $LOGNAME
28
+
29
+ # verify
30
+ rocminfo
31
+ clinfo
32
+ ```
33
+
34
+ ## Build pytorch
35
+
36
+ ``` bash
37
+ git clone https://github.com/pytorch/pytorch.git -b v1.13.1
38
+ cd pytorch
39
+ export PATH=/opt/rocm/bin:$PATH ROCM_PATH=/opt/rocm HIP_PATH=/opt/rocm/hip
40
+ export PYTORCH_ROCM_ARCH=gfx803
41
+ export PYTORCH_BUILD_VERSION=1.13.1 PYTORCH_BUILD_NUMBER=1
42
+ python3 tools/amd_build/build_amd.py
43
+ USE_ROCM=1 USE_NINJA=1 python3 setup.py bdist_wheel
44
+ pip3 install dist/torch-1.13.1-cp310-cp310-linux_x86_64.whl
45
+ ```
46
+
47
+ ## Build torchvision
48
+
49
+ ``` bash
50
+ git clone https://github.com/pytorch/vision.git -b v0.14.1
51
+ cd vision
52
+ export BUILD_VERSION=0.14.1
53
+ FORCE_CUDA=1 ROCM_HOME=/opt/rocm/ python3 setup.py bdist_wheel
54
+ pip3 install dist/torchvision-0.14.1-cp310-cp310-linux_x86_64.whl
55
+ ```
56
+
57
+ ## Test
58
+
59
+ ``` python
60
+ import torch
61
+ torch.cuda.is_available()
62
+ ```
63
+
64
+ ## Reference
65
+
66
+ - https://github.com/RadeonOpenCompute/ROCm/issues/1659
67
+ - https://github.com/xuhuisheng/rocm-gfx803
You can’t perform that action at this time.
0 commit comments