lshqqytiger / stable-diffusion-webui-amdgpu

Stable Diffusion web UI
GNU Affero General Public License v3.0
1.86k stars 191 forks source link

[Bug]: Unable to run with GPU on new AMD driver (23.5.2) #147

Closed ByronLeeeee closed 1 year ago

ByronLeeeee commented 1 year ago

Is there an existing issue for this?

What happened?

I updated AMD's latest driver 23.5.2 today and it claims Performance optimizations for Microsoft Olive DirectML pipeline for Stable Diffusion 1.5. Although it is only for the 7900 series, I own a 5700XT.

When I tested to see if it improved efficiency, I found that SD wasn't using my GPU, resulting in a one-seventh of the previous generation speed. (512x512 , Euler a , more than 15s/t).

What else can I do to solve this problem other than rolling back the driver?

BTW, I encountered a bug a long time ago, even if pull/re-git has a new version, it can't be solved: when I finish generating images, I can't browse the generated images in the web UI, I can only browse them in the output folder through the Explorer. Both Chrome and Edge have the same result.

Thanks.

Steps to reproduce the problem

  1. Update the latest AMD drivers.
  2. Generate images as usual.

What should have happened?

Run on GPU (even if it doesn't improve efficiency)

Commit where the problem happens

Commit hash: 0e4cbeb5318d1814a973509dfa45a6465f8719b5

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Other GPUs

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.9,max_split_size_mb:512
set COMMANDLINE_ARGS=--medvram --precision full --no-half --no-half-vae --opt-split-attention --disable-nan-check --autolaunch --api
set SAFETENSORS_FAST_GPU=1

call webui.bat

List of extensions

扩展 | 网址 | Branch | Commit | Date -- | -- | -- | -- | -- CFG-Schedule-for-Automatic1111-SD | https://github.com/guzuligo/CFG-Schedule-for-Automatic1111-SD.git | main | 84892c88 | Thu Mar 9 10:43:02 2023 C站助手(Civitai Helper) | https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper.git | main | fcf5a27a | Fri Apr 14 05:39:01 2023 Stable-Diffusion-Webui-Prompt-Translator | https://github.com/butaixianran/Stable-Diffusion-Webui-Prompt-Translator | main | d42efead | Sun Feb 19 10:55:24 2023 Tag自动补全 | https://github.com/DominikDoom/a1111-sd-webui-tagcomplete | main | 95ebde9f | Sat Mar 25 13:01:37 2023 显存评估插件(VRAM Estimator) | https://github.com/space-nuko/a1111-stable-diffusion-webui-vram-estimator.git | master | bf8797a3 | Sun Mar 5 03:42:33 2023 model-keyword | https://github.com/mix1009/model-keyword.git | main | f71cc19d | Sun Mar 5 06:00:21 2023 MultiDiffusion 放大器 | https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111.git | main | 554f9e85 | Sat Mar 25 08:03:32 2023 OpenPose 编辑器插件 | https://github.com/fkunn1326/openpose-editor.git | master | f35a7599 | Sat Mar 25 09:26:39 2023 3D OpenPose 编辑器插件(Posex) | https://github.com/hnmr293/posex.git | master | 233daf8e | Tue Mar 7 12:21:57 2023 sd-webui-aspect-ratio-helper | https://github.com/thomasasfk/sd-webui-aspect-ratio-helper.git | main | 1e8f7581 | Fri Mar 24 15:50:20 2023 双语对照翻译插件 | https://github.com/journey-ad/sd-webui-bilingual-localization.git | main | 89074f04 | Sat Mar 11 03:22:26 2023 ControlNet 插件 | https://github.com/Mikubill/sd-webui-controlnet.git | main | 241c05f8 | Thu Mar 23 15:18:35 2023 深度图编辑器插件 | https://github.com/jexom/sd-webui-depth-lib.git | main | 28a22387 | Mon Mar 6 21:02:28 2023 潜变量局部放大器 | https://github.com/hnmr293/sd-webui-llul.git | master | b20337ae | Wed Mar 22 15:56:08 2023 美术风格梯度 | https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients | master | 2624e5dd | Fri Jan 6 10:59:30 2023 stable-diffusion-webui-auto-translate-language | https://github.com/hyd998877/stable-diffusion-webui-auto-translate-language | main | ad6d2181 | Sat Mar 25 04:10:00 2023 图库浏览器 | https://github.com/yfszzx/stable-diffusion-webui-images-browser | main | c615bb02 | Fri Jan 27 13:12:23 2023 简体中文语言包 | https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN | main | 60da1198 | Wed Mar 22 06:59:31 2023 词元分析器(tokenizer) | https://github.com/AUTOMATIC1111/stable-diffusion-webui-tokenizer.git | master | ac6d541c | Sat Dec 10 12:58:31 2022 ultimate-upscale-for-automatic1111 | https://github.com/Coyote-A/ultimate-upscale-for-automatic1111.git | master | 0a3d03a4 | Tue Feb 7 06:07:23 2023 ### Console logs ```Shell venv "I:\Stable Diffusion\stable-diffusion-webui-directml\venv\Scripts\Python.exe" fatal: No names found, cannot describe anything. Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] Version: Commit hash: 0e4cbeb5318d1814a973509dfa45a6465f8719b5 Installing requirements Launching Web UI with arguments: --medvram --precision full --no-half --no-half-vae --opt-split-attention --disable-nan-check --autolaunch --api No module 'xformers'. Proceeding without it. Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled Civitai Helper: Get Custom Model Folder Civitai Helper: Load setting from: I:\Stable Diffusion\stable-diffusion-webui-directml\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json Civitai Helper: Set Proxy: http://127.0.0.1:10016 Loading weights [fc2511737a] from I:\Stable Diffusion\stable-diffusion-webui-directml\models\Stable-diffusion\chilloutmix_NiPrunedFp32Fix.safetensors Creating model from config: I:\Stable Diffusion\stable-diffusion-webui-directml\configs\v1-inference.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Running on local URL: http://127.0.0.1:7860 To create a public link, set `share=True` in `launch()`. Startup time: 18.2s (import torch: 4.8s, import gradio: 2.2s, import ldm: 1.0s, other imports: 1.9s, setup codeformer: 0.2s, load scripts: 5.5s, create ui: 1.0s, gradio launch: 1.5s, scripts app_started_callback: 0.1s). Applying optimization: Doggettx... done. Textual inversion embeddings loaded(5): -shuimo-, EasyNegative, ng_deepnegative_, pureerosface_v1, ulzzang-6500 Model loaded in 7.6s (load weights from disk: 0.7s, create model: 0.6s, apply weights to model: 6.0s, load textual inversion embeddings: 0.1s). 5%|████▏ | 1/20 [00:25<08:00, 25.30s/it] Total progress: 0%| | 0/20 [00:00
ByronLeeeee commented 1 year ago

To add: I've tried re-git and run the drawing in a completely clean environment and it has the same result. So I don't think there is much correlation with models and plugins.

ExRed commented 1 year ago

I have the same issue. However, I do not think that the updated driver is the issue. I get 9.53 s/it on commit 0e4cbeb5318d1814a973509dfa45a6465f8719b5 (current master), but git checkout to 5e48f300c1b74f0312f692dc8d0485b5120fc497 (one commit before) will get back to 3.00 it/s.

I am just a random dude on the internet, but @ByronLeeeee could you please try to type "git checkout 5e48f300c1b74f0312f692dc8d0485b5120fc497" into your terminal and try if it speeds up for you as well? This will revert to the precioous commit (to go back to the latest commit with "git checkout master")

ByronLeeeee commented 1 year ago

I have the same issue. However, I do not think that the updated driver is the issue. I get 9.53 s/it on commit 0e4cbeb (current master), but git checkout to 5e48f30 (one commit before) will get back to 3.00 it/s.

I am just a random dude on the internet, but @ByronLeeeee could you please try to type "git checkout 5e48f30" into your terminal and try if it speeds up for you as well? This will revert to the precioous commit (to go back to the latest commit with "git checkout master")

It worked! Thank you so much! @ExRed Its generation speed is back to the previous level, and it seems to have a little boost.

But I have another problem, after I finish generating an image, there is no response when I click the generate button again, unless I restart the UI, I can't generate the image again.

As well, the bug of not being able to see the generated images in the web ui still exists.

hkpD commented 1 year ago

I have the same issue. However, I do not think that the updated driver is the issue. I get 9.53 s/it on commit 0e4cbeb (current master), but git checkout to 5e48f30 (one commit before) will get back to 3.00 it/s.

I am just a random dude on the internet, but @ByronLeeeee could you please try to type "git checkout 5e48f30" into your terminal and try if it speeds up for you as well? This will revert to the precioous commit (to go back to the latest commit with "git checkout master")

Hi Random Dude On the Internet. This is why I love you, because you got my stuff working again.

Milor123 commented 1 year ago

I have the same issue. However, I do not think that the updated driver is the issue. I get 9.53 s/it on commit 0e4cbeb (current master), but git checkout to 5e48f30 (one commit before) will get back to 3.00 it/s.

I am just a random dude on the internet, but @ByronLeeeee could you please try to type "git checkout 5e48f30" into your terminal and try if it speeds up for you as well? This will revert to the precioous commit (to go back to the latest commit with "git checkout master")

I love you, it solve my NON GPU usage, after of bugging it using the git pull of today solved with git checkout 5e48f30

MartinLe12138 commented 1 year ago

Alternatively, add --backend=directml would also solve the problem. Seems that the latest --backend=auto which is the default is causing problem.

ByronLeeeee commented 1 year ago

Alternatively, add --backend=directml would also solve the problem. Seems that the latest --backend=auto which is the default is causing problem.

I tried it, and yes, it works! Thank you for providing another way! @MartinLe12138

lshqqytiger commented 1 year ago
Jojobata commented 1 year ago

I also have this problem with using my CPU but not my GPU (6700xt) and the command line does not work.. did I make a mistake? THANKS :)

git checkout 5e48f30 @echo off

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention

call webui.bat

lshqqytiger commented 1 year ago

Checkout ab1ef3e12982c8bf63fed1485929d4565394111f instead of 5e48f300c1b74f0312f692dc8d0485b5120fc497. If the problem still exists, add --backend directml.

Jojobata commented 1 year ago

Commander ab1ef3e12982c8bf63fed1485929d4565394111fau lieu de 5e48f300c1b74f0312f692dc8d0485b5120fc497. Si le problème persiste, ajoutez --backend directml.

Ok thank you, I add this in "webui-user.bat" is that right? sorry i'm a newbie

lshqqytiger commented 1 year ago

Yes. Replace git checkout ... with git pull.

Jojobata commented 1 year ago

thanks but it still doesn't work ;( i think i must be doing something wrong :

@echo off

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention git pull ab1ef3e12982c8bf63fed1485929d4565394111f call webui.bat

lshqqytiger commented 1 year ago

Just git pull. No url or commit hash after git pull.

Jojobata commented 1 year ago

ok thanks, and for the line "ab1ef3e12982c8bf63fed1485929d4565394111f" where do I insert it please?

Jojobata commented 1 year ago

something like this ? :

@echo off

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention git pull git chekout ab1ef3e12982c8bf63fed1485929d4565394111f call webui.bat

popsoda27 commented 1 year ago

may I ask where do I use --backend directml? I tried putting it in the cmd arguments and launching, it gave me error below launch.py: error: unrecognized arguments: --backend directml Press any key to continue . . .

MartinLe12138 commented 1 year ago

may I ask where do I use --backend directml? I tried putting it in the cmd arguments and launching, it gave me error below launch.py: error: unrecognized arguments: --backend directml Press any key to continue . . .

In webui-user.bat, add --backend=directml after the line set COMMANDLINE_ARGS=

something like this ? :

@echo off

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention git pull git chekout ab1ef3e call webui.bat

You don't need the git checkout line. Just keep the git pull should be fine.

popsoda27 commented 1 year ago

may I ask where do I use --backend directml? I tried putting it in the cmd arguments and launching, it gave me error below launch.py: error: unrecognized arguments: --backend directml Press any key to continue . . .

In webui-user.bat, add --backend=directml after the line set COMMANDLINE_ARGS=

That didn't work. My cmd argument: set COMMANDLINE_ARGS=--backend=directml --no-half --disable-nan-check --no-half-vae --opt-sub-quad-attention --api --autolaunch

when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml Press any key to continue . . .

MartinLe12138 commented 1 year ago

may I ask where do I use --backend directml? I tried putting it in the cmd arguments and launching, it gave me error below launch.py: error: unrecognized arguments: --backend directml Press any key to continue . . .

In webui-user.bat, add --backend=directml after the line set COMMANDLINE_ARGS=

That didn't work. My cmd argument: set COMMANDLINE_ARGS=--backend=directml --no-half --disable-nan-check --no-half-vae --opt-sub-quad-attention --api --autolaunch

when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml Press any key to continue . . .

Sounds like you're using an older commit, so you probably don't need --backend=directml. I think --backend was only implemented after 0e4cbeb. Also I don't think the latest commit needs --backend=directml. You may try git pull and use the original arguments without --backend.

Jojobata commented 1 year ago

puis-je demander où dois-je utiliser --backend directml ? J'ai essayé de le mettre dans les arguments cmd et de le lancer, cela m'a donné une erreur sous launch.py: erreur: arguments non reconnus: --backend directml Appuyez sur n'importe quelle touche pour continuer. . .

Dans webui-user.bat, ajoutez --backend=directmlaprès la ligneset COMMANDLINE_ARGS=

quelque chose comme ça ? : @echodésactivé set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention git pull git chekout ab1ef3e call webui . chauve souris

Vous n'avez pas besoin de la git checkoutligne. Gardez juste le git pulldevrait aller.

it doesn't work, i think i'll wait patiently for another solution ;(

rammstiengod commented 1 year ago

I've tried all the suggestions in here and its not helping. Would a full reinstall be a good idea? I'm doing the git pull in the .bat file but it doesn't seem to be updating anymore.

image

I've done a git pull before and it worked just fine until yesterday.

When I enter the --backend directml I keep getting:

when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml < I've tried both variations on this >

MartinLe12138 commented 1 year ago

I've tried all the suggestions in here and its not helping. Would a full reinstall be a good idea? I'm doing the git pull in the .bat file but it doesn't seem to be updating anymore.

image

I've done a git pull before and it worked just fine until yesterday.

When I enter the --backend directml I keep getting:

when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml < I've tried both variations on this >

That commit 22bcc7b is more than two months old and does not include the --backend argument. You should not include the --backend directml if you wish to stick with that. Try git pull https://github.com/lshqqytiger/stable-diffusion-webui-directml if you wish to update.

MartinLe12138 commented 1 year ago

Can I ask where should I use --Backend DirectML? I tried to put it in cmd arguments and launch it, it gave me an error under launch.py: error: unrecognized arguments: --backend directml Press any key to continue...

In webui-user.bat, add after the line--backend=directml``set COMMANDLINE_ARGS=

quelque chose comme ça ? : @echodésactivé set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention git pull git chekout ab1ef3e call webui . chauve souris

You don't need the line. Just keep the should go.git checkout``git pull

it doesn't work, i think i'll wait patiently for another solution ;(

Try this for your webui-user.bat:

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--skip-torch-cuda-test --medvram --no-half --precision full --opt-sub-quad-attention git pull https://github.com/lshqqytiger/stable-diffusion-webui-directml call webui.bat

rammstiengod commented 1 year ago

I've tried all the suggestions in here and its not helping. Would a full reinstall be a good idea? I'm doing the git pull in the .bat file but it doesn't seem to be updating anymore. image I've done a git pull before and it worked just fine until yesterday. When I enter the --backend directml I keep getting: when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml < I've tried both variations on this >

That commit 22bcc7b is more than two months old and does not include the --backend argument. You should not include the --backend directml if you wish to stick with that. Try git pull https://github.com/lshqqytiger/stable-diffusion-webui-directml if you wish to update.

This is what happens when I put in that line:

image

any idea on how I can fix that?

(also thanks for the help! I'm pretty bad when it comes to this stuff, building is more of my thing)

MartinLe12138 commented 1 year ago

I've tried all the suggestions in here and its not helping. Would a full reinstall be a good idea? I'm doing the git pull in the .bat file but it doesn't seem to be updating anymore. image I've done a git pull before and it worked just fine until yesterday. When I enter the --backend directml I keep getting: when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml < I've tried both variations on this >

That commit 22bcc7b is more than two months old and does not include the --backend argument. You should not include the --backend directml if you wish to stick with that. Try git pull https://github.com/lshqqytiger/stable-diffusion-webui-directml if you wish to update.

This is what happens when I put in that line:

image

any idea on how I can fix that?

(also thanks for the help! I'm pretty bad when it comes to this stuff, building is more of my thing)

Without knowing what exactly you changed and how important these changes are I cannot give a definitive answer. git stash will be the safe option if you wish to save the changes and later come back; however if you don't care git reset --hard followed by git pull will be your way to go.

rammstiengod commented 1 year ago

I've tried all the suggestions in here and its not helping. Would a full reinstall be a good idea? I'm doing the git pull in the .bat file but it doesn't seem to be updating anymore. image I've done a git pull before and it worked just fine until yesterday. When I enter the --backend directml I keep getting: when launching, the console threw back this error: launch.py: error: unrecognized arguments: --backend=directml < I've tried both variations on this >

That commit 22bcc7b is more than two months old and does not include the --backend argument. You should not include the --backend directml if you wish to stick with that. Try git pull https://github.com/lshqqytiger/stable-diffusion-webui-directml if you wish to update.

This is what happens when I put in that line: image any idea on how I can fix that? (also thanks for the help! I'm pretty bad when it comes to this stuff, building is more of my thing)

Without knowing what exactly you changed and how important these changes are I cannot give a definitive answer. git stash will be the safe option if you wish to save the changes and later come back; however if you don't care git reset --hard followed by git pull will be your way to go.

Thanks, I have no idea what happened. I just did a fresh install