lshqqytiger / stable-diffusion-webui-amdgpu

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

[Bug]: use_directml works, same PC, use_zluda run error #418

Open LYC878484 opened 8 months ago

LYC878484 commented 8 months ago

Checklist

What happened?

change set COMMANDLINE_ARGS=--use-directml --no-half --precision full --skip-torch-cuda-test --opt-sub-quad-attention --lowvram --disable-nan-check to set COMMANDLINE_ARGS=--use-zluda --no-half --precision full --skip-torch-cuda-test --opt-sub-quad-attention --lowvram --disable-nan-check,

Steps to reproduce the problem

1、change COMMANDLINE_ARGS 2、process "webui-user.bat", and set parameters on WEBUI 3、generate picture,error: RuntimeError: "log_vml_cpu" not implemented for 'Half' Time taken: 0.8 sec.

What should have happened?

use_zluda and use_directml can use on same environment,only need to change COMMANDLINE_ARGS

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

sysinfo-2024-03-17-11-50.json

Console logs

PS D:\GitResource\stable-diffusion-webui-directml> .\webui-user.bat
venv "D:\GitResource\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
WARNING: ZLUDA works best with SD.Next. Please consider migrating to SD.Next.
fatal: No names found, cannot describe anything.
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: 1.8.0-RC
Commit hash: 25a3b6cbeea8a07afd5e4594afc2f1c79f41ac1a
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: `pytorch_lightning.utilities.distributed.rank_zero_only` has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from `pytorch_lightning.utilities` instead.
  rank_zero_deprecation(
Launching Web UI with arguments: --use-zluda --no-half --precision full --skip-torch-cuda-test --opt-sub-quad-attention --lowvram --disable-nan-check
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
ONNX: selected=DmlExecutionProvider, available=['DmlExecutionProvider', 'CPUExecutionProvider']
==============================================================================
You are running torch 2.0.0+cpu.
The program is tested to work with torch 2.1.2.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
Loading weights [bb32ad727a] from D:\GitResource\stable-diffusion-webui-directml\models\Stable-diffusion\darkSushi25D25D_v40.safetensors
Creating model from config: D:\GitResource\stable-diffusion-webui-directml\configs\v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 2.1s (prepare environment: 4.5s, initialize shared: 0.6s, load scripts: 0.6s, create ui: 0.4s, gradio launch: 0.3s).
Couldn't find VAE named None; using None instead
Applying attention optimization: InvokeAI... done.
Model loaded in 2.5s (load weights from disk: 0.5s, create model: 0.3s, apply weights to model: 0.8s, apply float(): 0.7s).
                                  *** Error completing request
*** Arguments: ('task(chgb62lce9yr1dt)', <gradio.routes.Request object at 0x000001E6D622B5B0>, "A witch's house stands by a stream in the forest and a green witch tends the plants and trees in the garden. She has a beautiful face and shining eyes of vivid colors. She wears elaborate and delicate ornaments. The house stands in a lush green forest, decorated with plants and flowers under the eaves and on the door. Detailed drawings. Vivid colors. High image quality.", 'sketch, duplicate, ugly, huge eyes, text, logo,  worst face, (bad and mutated hands:1.3), (worst quality:2.0), (low quality:2.0), (blurry:2.0), horror, geometry, bad_prompt, (bad hands), (missing fingers), multiple limbs, bad anatomy, (interlocked fingers:1.2), Ugly Fingers, (extra digit and hands and fingers and legs and arms:1.4), ((2girl)), (deformed fingers:1.2), (long fingers:1.2),(bad-artist-anime), bad-artist, bad hand, extra legs, nipples,nsfw,', [], 20, 'DPM++ 2M Karras', 1, 1, 8, 576, 832, True, 0.5, 2, 'Latent', 20, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', ['Downcast alphas_cumprod: True', 'Clip skip: 2'], 0, False, '', 0.8, 3134855375, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "D:\GitResource\stable-diffusion-webui-directml\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "D:\GitResource\stable-diffusion-webui-directml\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\txt2img.py", line 110, in txt2img
        processed = processing.process_images(p)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\processing.py", line 787, in process_images
        res = process_images_inner(p)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\processing.py", line 1015, in process_images_inner
        samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\processing.py", line 1322, in sample
        self.sampler = sd_samplers.create_sampler(self.sampler_name, self.sd_model)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_samplers.py", line 36, in create_sampler
        sampler = config.constructor(model)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_samplers_kdiffusion.py", line 43, in <lambda>
        sd_samplers_common.SamplerData(label, lambda model, funcname=funcname: KDiffusionSampler(funcname, model), aliases, options)
      File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_samplers_kdiffusion.py", line 89, in __init__
        self.model_wrap = self.model_wrap_cfg.inner_model
      File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_samplers_kdiffusion.py", line 74, in inner_model
        self.model_wrap = denoiser(shared.sd_model, quantize=shared.opts.enable_quantization)
      File "D:\GitResource\stable-diffusion-webui-directml\repositories\k-diffusion\k_diffusion\external.py", line 135, in __init__
        super().__init__(model, model.alphas_cumprod, quantize=quantize)
      File "D:\GitResource\stable-diffusion-webui-directml\repositories\k-diffusion\k_diffusion\external.py", line 92, in __init__
        super().__init__(((1 - alphas_cumprod) / alphas_cumprod) ** 0.5, quantize)
      File "D:\GitResource\stable-diffusion-webui-directml\repositories\k-diffusion\k_diffusion\external.py", line 48, in __init__
        self.register_buffer('log_sigmas', sigmas.log())
    RuntimeError: "log_vml_cpu" not implemented for 'Half'

---

Additional information

my environment is windows10 + inter 12400F CPU + AMD6500XT

lshqqytiger commented 8 months ago

You can't skip cuda test with ZLUDA, and also you can't use the virtual environment that used with DirectML. Remove or rename (if you want to backup) venv folder and try again.

LYC878484 commented 8 months ago

You can't skip cuda test with ZLUDA, and also you can't use the virtual environment that used with DirectML. Remove or rename (if you want to backup) venv folder and try again.

follow you suggestion, rename venv to venv_directML and process .\webui-user.bat again, error:Failed to automatically patch torch with ZLUDA. Could not find ZLUDA from PATH.

now set COMMANDLINE_ARGS=--use-zluda --opt-sub-quad-attention --lowvram --disable-nan-check

Collecting mpmath>=0.19 Using cached https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB) Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, fsspec, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision Successfully installed MarkupSafe-2.1.3 certifi-2022.12.7 charset-normalizer-2.1.1 filelock-3.9.0 fsspec-2023.4.0 idna-3.4 jinja2-3.1.2 mpmath-1.3.0 networkx-3.2.1 numpy-1.26.3 pillow-10.2.0 requests-2.28.1 sympy-1.12 torch-2.2.0+cu118 torchvision-0.17.0+cu118 typing-extensions-4.8.0 urllib3-1.26.13

[notice] A new release of pip available: 22.2.1 -> 24.0 [notice] To update, run: D:\GitResource\stable-diffusion-webui-directml\venv\Scripts\python.exe -m pip install --upgrade pip Failed to automatically patch torch with ZLUDA. Could not find ZLUDA from PATH. Traceback (most recent call last): File "D:\GitResource\stable-diffusion-webui-directml\launch.py", line 48, in main() File "D:\GitResource\stable-diffusion-webui-directml\launch.py", line 39, in main prepare_environment() File "D:\GitResource\stable-diffusion-webui-directml\modules\launch_utils.py", line 568, in prepare_environment raise RuntimeError( RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check 请按任意键继续. . .

lshqqytiger commented 8 months ago

https://github.com/lshqqytiger/stable-diffusion-webui-directml/discussions/385#discussioncomment-8476128 You can skip step 3, 4. About step 6, cuDNN will be automatically disabled.

LYC878484 commented 8 months ago

#385 (comment) You can skip step 3, 4. About step 6, cuDNN will be automatically disabled.

Add HIP SDK and zluda directory to Path, this step i do not know how to do, could teach me, thanks

lshqqytiger commented 8 months ago

https://stackoverflow.com/a/44272417

LYC878484 commented 8 months ago

https://stackoverflow.com/a/44272417

path has add success. and reboot PC, WEBUI ok, another error like this : 1、loading stable diffusion model: RuntimeError 2、RuntimeError: "LayerNormKernelImpl" not implemented for 'Half' 3、AttributeError: 'NoneType' object has no attribute 'is_sdxl'

is it matter with my AMD6500XT?

image

PS D:\GitResource\stable-diffusion-webui-directml> .\webui-user.bat venv "D:\GitResource\stable-diffusion-webui-directml\venv\Scripts\Python.exe" WARNING: ZLUDA works best with SD.Next. Please consider migrating to SD.Next. fatal: No names found, cannot describe anything. Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: 1.8.0-RC Commit hash: 25a3b6cbeea8a07afd5e4594afc2f1c79f41ac1a Installing clip Installing open_clip Installing requirements no module 'xformers'. Processing without... no module 'xformers'. Processing without... No module 'xformers'. Proceeding without it. D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: pytorch_lightning.utilities.distributed.rank_zero_only has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from pytorch_lightning.utilities instead. rank_zero_deprecation( Launching Web UI with arguments: --use-zluda --opt-sub-quad-attention --lowvram --disable-nan-check ONNX: selected=DmlExecutionProvider, available=['AzureExecutionProvider', 'CPUExecutionProvider'] ZLUDA device failed to pass basic operation test: index=None, device_name=AMD Radeon(TM) RX 6500 XT [ZLUDA] Loading weights [bb32ad727a] from D:\GitResource\stable-diffusion-webui-directml\models\Stable-diffusion\darkSushi25D25D_v40.safetensors Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Creating model from config: D:\GitResource\stable-diffusion-webui-directml\configs\v1-inference.yaml Startup time: 73.2s (prepare environment: 74.1s, initialize shared: 3.6s, load scripts: 0.3s, create ui: 0.3s, gradio launch: 0.3s). Couldn't find VAE named None; using None instead Applying attention optimization: InvokeAI... done. loading stable diffusion model: RuntimeError Traceback (most recent call last): File "D:\Program Files\Python\Python310\lib\threading.py", line 973, in _bootstrap self._bootstrap_inner() File "D:\Program Files\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "D:\Program Files\Python\Python310\lib\threading.py", line 953, in run self._target(*self._args, self._kwargs) File "D:\GitResource\stable-diffusion-webui-directml\modules\initialize.py", line 148, in load_model shared.sd_model # noqa: B018 File "D:\GitResource\stable-diffusion-webui-directml\modules\shared_items.py", line 148, in sd_model return modules.sd_models.model_data.get_sd_model() File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_models.py", line 627, in get_sd_model load_model() File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_models.py", line 789, in load_model sd_model.cond_stage_model_empty_prompt = get_empty_cond(sd_model) File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_models.py", line 665, in get_empty_cond return sd_model.cond_stage_model([""]) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_hijack_clip.py", line 234, in forward z = self.process_tokens(tokens, multipliers) File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_hijack_clip.py", line 276, in process_tokens z = self.encode_with_transformers(tokens) File "D:\GitResource\stable-diffusion-webui-directml\modules\sd_hijack_clip.py", line 331, in encode_with_transformers outputs = self.wrapped.transformer(input_ids=tokens, output_hidden_states=-opts.CLIP_stop_at_last_layers) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1561, in _call_impl result = forward_call(*args, *kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 822, in forward return self.text_model( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 740, in forward encoder_outputs = self.encoder( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 654, in forward layer_outputs = encoder_layer( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, *kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 382, in forward hidden_states = self.layer_norm1(hidden_states) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl return forward_call(*args, **kwargs) File "D:\GitResource\stable-diffusion-webui-directml\extensions-builtin\Lora\networks.py", line 545, in network_LayerNorm_forward return originals.LayerNorm_forward(self, input) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\normalization.py", line 201, in forward return F.layer_norm( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\functional.py", line 2546, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'

Stable diffusion model failed to load Traceback (most recent call last): File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 703, in pages_html create_html() File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 699, in create_html ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages] File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 699, in ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages] File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 518, in create_html self.items = {x["name"]: x for x in items_list} File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 518, in self.items = {x["name"]: x for x in items_list} File "D:\GitResource\stable-diffusion-webui-directml\extensions-builtin\Lora\ui_extra_networks_lora.py", line 82, in list_items item = self.create_item(name, index) File "D:\GitResource\stable-diffusion-webui-directml\extensions-builtin\Lora\ui_extra_networks_lora.py", line 69, in create_item elif shared.sd_model.is_sdxl and sd_version != network.SdVersion.SDXL: AttributeError: 'NoneType' object has no attribute 'is_sdxl' Traceback (most recent call last): File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "D:\GitResource\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, kwargs) File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 703, in pages_html create_html() File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 699, in create_html ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages] File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 699, in ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages] File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 518, in create_html self.items = {x["name"]: x for x in items_list} File "D:\GitResource\stable-diffusion-webui-directml\modules\ui_extra_networks.py", line 518, in self.items = {x["name"]: x for x in items_list} File "D:\GitResource\stable-diffusion-webui-directml\extensions-builtin\Lora\ui_extra_networks_lora.py", line 82, in list_items item = self.create_item(name, index) File "D:\GitResource\stable-diffusion-webui-directml\extensions-builtin\Lora\ui_extra_networks_lora.py", line 69, in create_item elif shared.sd_model.is_sdxl and sd_version != network.SdVersion.SDXL: AttributeError: 'NoneType' object has no attribute 'is_sdxl'

lshqqytiger commented 8 months ago

RX 6500 XT is gfx1034, which is officially not supported by HIP SDK. But you can build required files yourself. And there are some people who already did it: https://github.com/brknsoul/ROCmLibs but it does not contain gfx1034 one. Related: https://www.reddit.com/r/StableDiffusion/comments/1asewch/installing_zluda_for_amd_gpus_in_windows_ie_use/

LYC878484 commented 8 months ago

RX 6500 XT is gfx1034, which is officially not supported by HIP SDK. But you can build required files yourself. And there are some people who already did it: https://github.com/brknsoul/ROCmLibs but it does not contain gfx1034 one. Related: https://www.reddit.com/r/StableDiffusion/comments/1asewch/installing_zluda_for_amd_gpus_in_windows_ie_use/

can you help me to download Tensile-fix-fallback-arch-build.patch, i do not have right to get it

image

lshqqytiger commented 8 months ago

Try logging in or creating an account the message says.

Kerorowong commented 7 months ago

Previously running alright. Now having the same problem as LYC878484