Skip to content

Forcing PyTorch version for AMD GPUs automatic install#9404

Merged
AUTOMATIC1111 merged 3 commits intoAUTOMATIC1111:devfrom
DGdev91:master
Apr 29, 2023
Merged

Forcing PyTorch version for AMD GPUs automatic install#9404
AUTOMATIC1111 merged 3 commits intoAUTOMATIC1111:devfrom
DGdev91:master

Conversation

@DGdev91
Copy link
Copy Markdown
Contributor

@DGdev91 DGdev91 commented Apr 5, 2023

The old code tries to install the newest versions of pytorch, wich is currently 2.0. Forcing it to 1.13.1

should also fix #9402

The old code tries to install the newest versions of pytorch, wich is currently 2.0. Forcing it to 1.13.1
@CapsAdmin
Copy link
Copy Markdown

Aren't we supposed to use pytorch 2.0 now?

@DGdev91
Copy link
Copy Markdown
Contributor Author

DGdev91 commented Apr 7, 2023

Aren't we supposed to use pytorch 2.0 now?

Not yet. There are many people wich are already using pytorch 2.0, but the default TORCH_COMMAND is still 1.13.1 in launch.py:

torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117")
Also, i'm having the issue mentioned in #8139 while using that. Another user mentioned he's having the opposite issue (working fine in pytorch2, not working in 1.13.1) wich is really wierd, so maybe isn't really a pytorch2 issue, but i feel it's safer to keep it to 1.13.1 for now

@Sakura-Luna
Copy link
Copy Markdown
Collaborator

Sakura-Luna commented Apr 10, 2023

PyTorch seems to have screwed up the install command and now suggests --index-url instead of --extra-index-url. #9483

@DGdev91
Copy link
Copy Markdown
Contributor Author

DGdev91 commented Apr 11, 2023

PyTorch seems to have screwed up the install command and now suggests --index-url instead of --extra-index-url. #9483

In the "install previous versions" page it still uses --extra-index-url https://pytorch.org/get-started/previous-versions/
But i tried doing a fresh install using --index-url and it worked fine. i guess it's better using that, then.

@DGdev91 DGdev91 mentioned this pull request Apr 27, 2023
1 task
@DGdev91
Copy link
Copy Markdown
Contributor Author

DGdev91 commented Apr 29, 2023

I know that #9191 has just been merged and now the torch base enviroment is PyTorch2, but i'm having some issues with it on my RX 5700XT, it gives me "bus error" when i try to generate an image.
Works without problems on the old Pytorch 1.13.1

i don't know if it's just me, but i think is safer to keep 1.13.1 for AMD users until the next ROCm version is released

@AUTOMATIC1111 AUTOMATIC1111 changed the base branch from master to dev April 29, 2023 11:08
@AUTOMATIC1111 AUTOMATIC1111 merged commit 7b02b17 into AUTOMATIC1111:dev Apr 29, 2023
@Soulreaver90
Copy link
Copy Markdown

I know that #9191 has just been merged and now the torch base enviroment is PyTorch2, but i'm having some issues with it on my RX 5700XT, it gives me "bus error" when i try to generate an image. Works without problems on the old Pytorch 1.13.1

i don't know if it's just me, but i think is safer to keep 1.13.1 for AMD users until the next ROCm version is released

That’s weird, I have a 6700xt and been running torch 2.0 with no issue at for the past month or so. Install the newest rocm 5.4.2/3 drivers, remove all instances or torch and reinstall from scratch. Unless this is an issue only affecting the 5000 series.

@DianaNites
Copy link
Copy Markdown

The issue is that it depends on the card, some work fine on 2.x and some only work on 1.x, and some work on both but are faster on one. Theres no one version that everything works well on, sadly.

Hopefully a new ROCm or PyTorch version fixes this

@DGdev91
Copy link
Copy Markdown
Contributor Author

DGdev91 commented Apr 29, 2023

The issue is that it depends on the card, some work fine on 2.x and some only work on 1.x, and some work on both but are faster on one. Theres no one version that everything works well on, sadly.

Hopefully a new ROCm or PyTorch version fixes this

Precisely.
That's why it's better to stick to the older version for now, and eventually update it when the next rocm version gets released.

And for user wich have installed pytorch2 manually, they can just continue to use it without any problem

@popsoda27
Copy link
Copy Markdown

Fresh installation of Automatic1111 still installing pytorch 2.0 on first launch of webui-user.bat, which later prompts the message about not able to use GPU. Test generating an image, no usage of GPU at all....a 512x768 image takes 1hr.

Deleted venv folder and tried to manually install:
PS E:\Downloads\stable-diffusion-webui> pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --extra-index-url https://download.pytorch.org/whl/rocm5.2 --upgrade --force-reinstall
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/rocm5.2
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+rocm5.2 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0)
ERROR: No matching distribution found for torch==1.13.1+rocm5.2

??? what should I do next to get the older version torch?
I'm on AMD 6700xt and Win11

@DGdev91
Copy link
Copy Markdown
Contributor Author

DGdev91 commented May 3, 2023

Fresh installation of Automatic1111 still installing pytorch 2.0 on first launch of webui-user.bat, which later prompts the message about not able to use GPU. Test generating an image, no usage of GPU at all....a 512x768 image takes 1hr.

Deleted venv folder and tried to manually install: PS E:\Downloads\stable-diffusion-webui> pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --extra-index-url https://download.pytorch.org/whl/rocm5.2 --upgrade --force-reinstall Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/rocm5.2 ERROR: Could not find a version that satisfies the requirement torch==1.13.1+rocm5.2 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0) ERROR: No matching distribution found for torch==1.13.1+rocm5.2

??? what should I do next to get the older version torch? I'm on AMD 6700xt and Win11

That's for Linux + ROCm drivers only. It's currently not possible to use it on windows on AMD because there's no support for PyTorch (yet)
There are some forks wich uses different technologies and work with windows too, but they are slower and some features aren't supported.

It's all written in the docs:
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-AMD-GPUs

Windows+AMD support has not officially been made for webui,
but you can install lshqqytiger's fork of webui that uses Direct-ml.

@YANGWRY
Copy link
Copy Markdown

YANGWRY commented Jun 20, 2023

my MacBook pro also have this question.
2.3 GHz 八核Intel Core i9;AMD Radeon Pro 5500M 4 GB;Intel UHD Graphics 630 1536 MB;CPU:16 GB 2667 MHz DDR4
How to fix it?

@DGdev91
Copy link
Copy Markdown
Contributor Author

DGdev91 commented Jun 20, 2023

my MacBook pro also have this question. 2.3 GHz 八核Intel Core i9;AMD Radeon Pro 5500M 4 GB;Intel UHD Graphics 630 1536 MB;CPU:16 GB 2667 MHz DDR4 How to fix it?

This is an old pull request for some code wich has been partially re-written on newer versions.
Also, this is for Linux only. Are you running linux on that?
There is experimental support for newer macbooks with Apple Silicon, but for your machine it will probably be impossible to run StableDiffusion on GPU unless you are using Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

8 participants