nVidia GPUやAMD GPUを使ってStable Diffusion をやるって話はあるけど、AMD Ryzen GPU付きのGPU部分を使ってできるのか、ってのがよく分からなかったので試してみた。
webui-user.bat をコピーして、 COMMANDLINE_ARGSのある行を「set COMMANDLINE_ARGS=–opt-sub-quad-attention –lowvram –disable-nan-check」に変えることで生成に成功した。
「No module ‘xformers’. Proceeding without it.」はnVidia GPUじゃないと動かないのでこれは正常動作。
Web GUIの「Extensions」の「Install from URL」に「https://github.com/Mikubill/sd-webui-controlnet.git」を入れて、手順を行う
PS C:\stablediff\stable-diffusion-webui-directml> .\webui-user-amd.bat
venv "C:\stablediff\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: ## 1.4.0
Commit hash: 265d626471eacd617321bdb51e50e4b87a7ca82e
Installing requirements
Launching Web UI with arguments: --opt-sub-quad-attention --lowvram --disable-nan-check --autolaunch
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
reading checkpoint metadata: C:\stablediff\stable-diffusion-webui-directml\models\Stable-diffusion\unlimitedReplicant_v10.safetensors: AssertionError
Traceback (most recent call last):
File "C:\stablediff\stable-diffusion-webui-directml\modules\sd_models.py", line 62, in __init__
self.metadata = read_metadata_from_safetensors(filename)
File "C:\stablediff\stable-diffusion-webui-directml\modules\sd_models.py", line 236, in read_metadata_from_safetensors
assert metadata_len > 2 and json_start in (b'{"', b"{'"), f"{filename} is not a safetensors file"
AssertionError: C:\stablediff\stable-diffusion-webui-directml\models\Stable-diffusion\unlimitedReplicant_v10.safetensors is not a safetensors file
2023-07-12 13:46:53,471 - ControlNet - INFO - ControlNet v1.1.232
ControlNet preprocessor location: C:\stablediff\stable-diffusion-webui-directml\extensions\sd-webui-controlnet\annotator\downloads
2023-07-12 13:46:53,548 - ControlNet - INFO - ControlNet v1.1.232
Loading weights [c348e5681e] from C:\stablediff\stable-diffusion-webui-directml\models\Stable-diffusion\muaccamix_v15.safetensors
preload_extensions_git_metadata for 8 extensions took 0.13s
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 7.2s (import torch: 2.2s, import gradio: 1.0s, import ldm: 0.5s, other imports: 1.2s, load scripts: 1.3s, create ui: 0.4s, gradio launch: 0.5s).
Creating model from config: C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\configs\stable-diffusion\v2-inference-v.yaml
LatentDiffusion: Running in v-prediction mode
DiffusionWrapper has 865.91 M params.
Applying attention optimization: sub-quadratic... done.
Textual inversion embeddings loaded(0):
Model loaded in 7.1s (load weights from disk: 0.7s, find config: 2.4s, create model: 0.2s, apply weights to model: 1.9s, apply half(): 1.0s, move model to device: 0.3s, calculate empty prompt: 0.4s).
Loading weights [e3b0c44298] from C:\stablediff\stable-diffusion-webui-directml\models\Stable-diffusion\unlimitedReplicant_v10.safetensors
changing setting sd_model_checkpoint to unlimitedReplicant_v10.safetensors [e3b0c44298]: SafetensorError
Traceback (most recent call last):
File "C:\stablediff\stable-diffusion-webui-directml\modules\shared.py", line 610, in set
self.data_labels[key].onchange()
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 13, in f
res = func(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\webui.py", line 226, in <lambda>
shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights()), call=False)
File "C:\stablediff\stable-diffusion-webui-directml\modules\sd_models.py", line 568, in reload_model_weights
state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
File "C:\stablediff\stable-diffusion-webui-directml\modules\sd_models.py", line 277, in get_checkpoint_state_dict
res = read_state_dict(checkpoint_info.filename)
File "C:\stablediff\stable-diffusion-webui-directml\modules\sd_models.py", line 256, in read_state_dict
pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\safetensors\torch.py", line 259, in load_file
with safe_open(filename, framework="pt", device=device) as f:
safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooSmall
*** Error completing request
*** Arguments: ('task(d0d406cu3531u31)', 'miku\n', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 0, '', '', [], 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001FAA7416110>, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, 50) {}
Traceback (most recent call last):
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 55, in f
res = list(func(*args, **kwargs))
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 35, in f
res = func(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\txt2img.py", line 94, in txt2img
processed = processing.process_images(p)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 623, in process_images
res = process_images_inner(p)
File "C:\stablediff\stable-diffusion-webui-directml\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 732, in process_images_inner
p.setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 1129, in setup_conds
super().setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 346, in setup_conds
self.uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, self.negative_prompts, self.steps * self.step_multiplier, [self.cached_uc], self.extra_network_data)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 338, in get_conds_with_caching
cache[1] = function(shared.sd_model, required_prompts, steps)
File "C:\stablediff\stable-diffusion-webui-directml\modules\prompt_parser.py", line 143, in get_learned_conditioning
conds = model.get_learned_conditioning(texts)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 665, in get_learned_conditioning
c = self.cond_stage_model.encode(c)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 236, in encode
return self(text)
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 213, in forward
z = self.encode_with_transformer(tokens.to(self.device))
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\cuda\__init__.py", line 239, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
---
*** Error completing request
*** Arguments: ('task(rw9uda96ly6wovo)', 'miku\n', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 0, '', '', [], 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001FA000A6620>, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, 50) {}
Traceback (most recent call last):
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 55, in f
res = list(func(*args, **kwargs))
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 35, in f
res = func(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\txt2img.py", line 94, in txt2img
processed = processing.process_images(p)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 623, in process_images
res = process_images_inner(p)
File "C:\stablediff\stable-diffusion-webui-directml\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 732, in process_images_inner
p.setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 1129, in setup_conds
super().setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 346, in setup_conds
self.uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, self.negative_prompts, self.steps * self.step_multiplier, [self.cached_uc], self.extra_network_data)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 338, in get_conds_with_caching
cache[1] = function(shared.sd_model, required_prompts, steps)
File "C:\stablediff\stable-diffusion-webui-directml\modules\prompt_parser.py", line 143, in get_learned_conditioning
conds = model.get_learned_conditioning(texts)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 665, in get_learned_conditioning
c = self.cond_stage_model.encode(c)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 236, in encode
return self(text)
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 213, in forward
z = self.encode_with_transformer(tokens.to(self.device))
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\cuda\__init__.py", line 239, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
---
*** Error completing request
*** Arguments: ('task(qgndomumiw4zfai)', 'miku\n', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 0, '', '', [], 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001FAA6F229E0>, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, 50) {}
Traceback (most recent call last):
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 55, in f
res = list(func(*args, **kwargs))
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 35, in f
res = func(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\txt2img.py", line 94, in txt2img
processed = processing.process_images(p)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 623, in process_images
res = process_images_inner(p)
File "C:\stablediff\stable-diffusion-webui-directml\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 732, in process_images_inner
p.setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 1129, in setup_conds
super().setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 346, in setup_conds
self.uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, self.negative_prompts, self.steps * self.step_multiplier, [self.cached_uc], self.extra_network_data)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 338, in get_conds_with_caching
cache[1] = function(shared.sd_model, required_prompts, steps)
File "C:\stablediff\stable-diffusion-webui-directml\modules\prompt_parser.py", line 143, in get_learned_conditioning
conds = model.get_learned_conditioning(texts)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 665, in get_learned_conditioning
c = self.cond_stage_model.encode(c)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 236, in encode
return self(text)
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 213, in forward
z = self.encode_with_transformer(tokens.to(self.device))
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\cuda\__init__.py", line 239, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
---
Restarting UI...
Closing server running on port: 7860
2023-07-12 13:54:32,359 - ControlNet - INFO - ControlNet v1.1.232
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 0.6s (load scripts: 0.3s, create ui: 0.2s).
preload_extensions_git_metadata for 8 extensions took 0.15s
*** Error completing request
*** Arguments: ('task(jwkb7fcvkg7wpb4)', 'miku', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 0, '', '', [], 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001FB1BC5F010>, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, 50) {}
Traceback (most recent call last):
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 55, in f
res = list(func(*args, **kwargs))
File "C:\stablediff\stable-diffusion-webui-directml\modules\call_queue.py", line 35, in f
res = func(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\txt2img.py", line 94, in txt2img
processed = processing.process_images(p)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 623, in process_images
res = process_images_inner(p)
File "C:\stablediff\stable-diffusion-webui-directml\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 732, in process_images_inner
p.setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 1129, in setup_conds
super().setup_conds()
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 346, in setup_conds
self.uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, self.negative_prompts, self.steps * self.step_multiplier, [self.cached_uc], self.extra_network_data)
File "C:\stablediff\stable-diffusion-webui-directml\modules\processing.py", line 338, in get_conds_with_caching
cache[1] = function(shared.sd_model, required_prompts, steps)
File "C:\stablediff\stable-diffusion-webui-directml\modules\prompt_parser.py", line 143, in get_learned_conditioning
conds = model.get_learned_conditioning(texts)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 665, in get_learned_conditioning
c = self.cond_stage_model.encode(c)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 236, in encode
return self(text)
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 213, in forward
z = self.encode_with_transformer(tokens.to(self.device))
File "C:\stablediff\stable-diffusion-webui-directml\venv\lib\site-packages\torch\cuda\__init__.py", line 239, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
---
fatal: No names found, cannot describe anything.
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: ## 1.4.0
Commit hash: 265d626471eacd617321bdb51e50e4b87a7ca82e
Installing requirements
Launching Web UI with arguments: --opt-sub-quad-attention --lowvram --disable-nan-check --autolaunch
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
Loading weights [c348e5681e] from C:\stablediff\stable-diffusion-webui-directml\models\Stable-diffusion\muaccamix_v15.safetensors
preload_extensions_git_metadata for 8 extensions took 0.13s
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 6.6s (import torch: 2.2s, import gradio: 1.0s, import ldm: 0.5s, other imports: 1.2s, load scripts: 1.0s, create ui: 0.5s, gradio launch: 0.2s).
Creating model from config: C:\stablediff\stable-diffusion-webui-directml\repositories\stable-diffusion-stability-ai\configs\stable-diffusion\v2-inference-v.yaml
LatentDiffusion: Running in v-prediction mode
DiffusionWrapper has 865.91 M params.
Applying attention optimization: sub-quadratic... done.
Textual inversion embeddings loaded(0):
Model loaded in 6.3s (load weights from disk: 0.7s, find config: 1.7s, create model: 0.6s, apply weights to model: 1.6s, apply half(): 1.0s, move model to device: 0.3s, calculate empty prompt: 0.4s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [01:44<00:00, 5.23s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [01:41<00:00, 5.06s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [01:41<00:00, 5.08s/it]