vladmandic / automatic

SD.Next: Advanced Implementation Generative Image Models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.75k stars 431 forks source link

[Issue]: Zluda unable to utilize GPU to generate images #3560

Closed Tancen closed 1 week ago

Tancen commented 2 weeks ago

Issue Description

As can be seen from the log below, webui.bat automatically uses the torch 2.5.1+CPU solution even though it detects ROCm and ZLUDA. So when generating the picture, I checked the data of Windows Task Manager, my GPU is as usual, but the CPU is running crazy, And zluda is not running during image generation.


D:\sdnext\automatic>.\webui.bat --use-zluda
Using VENV: D:\sdnext\automatic\venv
11:03:44-942823 INFO     Starting SD.Next
11:03:44-944824 INFO     Logger: file="D:\sdnext\automatic\sdnext.log" level=INFO size=48452 mode=append
11:03:44-944824 INFO     Python: version=3.11.5 platform=Windows bin="D:\sdnext\automatic\venv\Scripts\python.exe"
                         venv="D:\sdnext\automatic\venv"
11:03:45-083571 INFO     Version: app=sd.next updated=2024-11-02 hash=65ddc611 branch=master
                         url=https://github.com/vladmandic/automatic/tree/master ui=main
11:03:45-907757 INFO     Platform: arch=AMD64 cpu=AMD64 Family 25 Model 97 Stepping 2, AuthenticAMD system=Windows
                         release=Windows-10-10.0.22631-SP0 python=3.11.5
11:03:45-908755 INFO     Args: ['--use-zluda']
11:03:45-916145 INFO     Python: version=3.11.5 platform=Windows bin="D:\sdnext\automatic\venv\Scripts\python.exe"
                         venv="D:\sdnext\automatic\venv"
11:03:45-918146 INFO     ROCm: AMD toolkit detected
11:03:46-394129 INFO     ROCm: agents=['gfx1100', 'gfx1036']
11:03:46-395129 INFO     ROCm: version=5.7, using agent gfx1100
11:03:46-396129 WARNING  ZLUDA support: experimental
11:06:18-697121 INFO     Using ZLUDA in D:\sdnext\automatic\.zluda
11:06:21-002327 WARNING  Modified files: ['startup.cmd']
11:06:21-031978 INFO     Verifying requirements
11:06:21-038491 INFO     Verifying packages
11:06:21-078246 INFO     Extensions: disabled=[]
11:06:21-079247 INFO     Extensions: enabled=['Lora', 'sd-extension-chainner', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sdnext-modernui', 'stable-diffusion-webui-rembg']
                         extensions-builtin
11:06:21-081423 INFO     Extensions: enabled=[] extensions
11:06:21-082931 INFO     Startup: standard
11:06:21-083934 INFO     Verifying submodules
11:06:33-150728 INFO     Extensions enabled: ['Lora', 'sd-extension-chainner', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sdnext-modernui', 'stable-diffusion-webui-rembg']
11:06:33-152328 INFO     Verifying requirements
11:06:33-155838 INFO     Command line args: ['--use-zluda'] use_zluda=True
11:06:39-762034 INFO     System packages: {'torch': '2.5.1+cpu', 'diffusers': '0.32.0.dev0', 'gradio': '3.43.2',
                         'transformers': '4.46.1', 'accelerate': '1.0.1'}
11:06:40-499104 INFO     Engine: backend=Backend.DIFFUSERS compute=cpu device=cpu attention="Scaled-Dot-Product"
                         mode=no_grad
11:06:40-507350 INFO     Torch parameters: backend=cpu device=cpu config=Auto dtype=torch.bfloat16 vae=torch.bfloat16
                         unet=torch.bfloat16 context=no_grad nohalf=False nohalfvae=False upscast=False
                         deterministic=False test-fp16=True test-bf16=True optimization="Scaled-Dot-Product"
11:06:41-072952 INFO     Device:
11:06:41-368796 INFO     Available VAEs: path="models\VAE" items=0
11:06:41-369795 INFO     Available UNets: path="models\UNET" items=0
11:06:41-370798 INFO     Available TEs: path="models\Text-encoder" items=0
11:06:41-371808 INFO     Disabled extensions: ['sdnext-modernui']
11:06:41-377505 INFO     Available Models: path="D:\sdnext\automatic\models\Diffusers" items=1 time=0.01
11:06:41-426486 INFO     Available Yolo: path="models\yolo" items=6 downloaded=0
11:06:41-473501 INFO     Available LoRAs: path="models\Lora" items=0 folders=2 time=0.00
11:06:42-023129 INFO     Extension: script='extensions-builtin\sd-webui-agent-scheduler\scripts\task_scheduler.py' Using
                         sqlite file: extensions-builtin\sd-webui-agent-scheduler\task_scheduler.sqlite3
11:06:42-050787 INFO     Available Upscalers: items=53 downloaded=0 user=0 time=0.02 types=['None', 'Lanczos',
                         'Nearest', 'ChaiNNer', 'AuraSR', 'ESRGAN', 'LDSR', 'RealESRGAN', 'SCUNet', 'SD', 'SwinIR']
11:06:42-442096 INFO     Available Styles: folder="models\styles" items=288 time=0.39
11:06:42-445969 INFO     UI theme: type=Standard name="black-teal"
11:06:42-468557 ERROR    Extra networks error listing items: class=ExtraNetworksPageCheckpoints tab=txt2img 'NoneType'
                         object is not subscriptable
11:06:42-474915 ERROR    Extra networks error listing items: class=ExtraNetworksPageCheckpoints tab=txt2img 'NoneType'
                         object is not subscriptable
11:06:42-649829 ERROR    Extra networks error listing items: class=ExtraNetworksPageCheckpoints tab=img2img 'NoneType'
                         object is not subscriptable
11:06:42-755293 ERROR    Extra networks error listing items: class=ExtraNetworksPageCheckpoints tab=control 'NoneType'
                         object is not subscriptable
11:06:43-316332 INFO     Extension list is empty: refresh required
11:06:43-883184 INFO     Local URL: http://127.0.0.1:7860/
11:06:43-988274 INFO     [AgentScheduler] Task queue is empty
11:06:43-989275 INFO     [AgentScheduler] Registering APIs
11:06:44-322662 INFO     Model metadata saved: file="metadata.json" items=1 time=0.00
11:06:44-324665 INFO     Load model: select="v1-5-pruned-emaonly [6ce0161689]"
11:06:44-325665 INFO     Autodetect model: detect="Stable Diffusion" class=StableDiffusionPipeline
                         file="D:\sdnext\automatic\models\Diffusers\v1-5-pruned-emaonly.safetensors" size=4068MB
Diffusers  7.08it/s ████████ 100% 6/6 00:00 00:00 Loading pipeline components...
11:06:45-515798 INFO     Load network: type=embeddings loaded=0 skipped=0 time=0.00
11:06:45-789296 INFO     Load model: time=1.20 load=1.19 native=512 memory={'ram': {'used': 2.7, 'total': 63.16}}
11:06:45-792305 INFO     Startup time: 12.63 torch=4.12 onnx=0.06 gradio=2.25 diffusers=0.08 libraries=1.49
                         samplers=0.21 extensions=0.60 networks=0.39 ui-networks=0.12 ui-txt2img=0.14 ui-img2img=0.06
                         ui-control=0.09 ui-settings=0.38 ui-extensions=0.45 launch=0.09 api=0.06 app-started=0.38
                         checkpoint=1.47
11:17:49-449051 INFO     Browser session: user=None client=127.0.0.1 agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                         AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
11:17:51-832098 ERROR    MOTD: HTTPSConnectionPool(host='vladmandic.github.io', port=443): Read timed out. (read
                         timeout=3)
11:18:03-273125 INFO     Base: class=StableDiffusionPipeline
Progress 10.92s/it █████████████████████████████████ 100% 20/20 03:38 00:00 Base
11:21:49-309186 INFO     Save: image="outputs\text\00001-v1-5-pruned-emaonly-a dog.jpg" type=JPEG width=1024 height=1024
                         size=223453
11:21:49-315192 INFO     Processed: images=1 its=0.09 time=226.04 timers={'encode': 0.08, 'args': 0.1, 'pipeline':
                         218.4, 'decode': 7.51, 'post': 0.03} memory={'ram': {'used': 3.11, 'total': 63.16}}

Version Platform Description

Program Version: I don't know where to see the version information, I cloned from the master branch two days ago OS: Windows 11 browser: Google Chrome 130.0.6723.91

Relevant log output

No response

Backend

Diffusers

UI

Standard

Branch

Master

Model

Other

Acknowledgements

vladmandic commented 1 week ago

please run webui --use-zluda --reinstall to check which torch actually gets installed

Tancen commented 1 week ago

please run webui --use-zluda --reinstall to check which torch actually gets installed

I executed ./webui.bat --use-zluda --reinstall many times, and each time ZLUDA failed to install. Can I manually download and install it from https://github.com/vosen/ZLUDA?


PS D:\sdnext\automatic> ./webui.bat --use-zluda --reinstall
Using python: "D:\Python\Python311\python.exe"
Creating VENV: D:\sdnext\automatic\venv
Using VENV: D:\sdnext\automatic\venv
09:13:36-708485 INFO     Starting SD.Next
09:13:36-710492 INFO     Logger: file="D:\sdnext\automatic\sdnext.log" level=INFO size=65 mode=append
09:13:36-711001 INFO     Python: version=3.11.5 platform=Windows bin="D:\sdnext\automatic\venv\Scripts\python.exe"
                         venv="D:\sdnext\automatic\venv"
09:13:36-886327 INFO     Version: app=sd.next updated=2024-11-02 hash=65ddc611 branch=master
                         url=https://github.com/vladmandic/automatic/tree/master ui=main
09:13:37-802051 INFO     Platform: arch=AMD64 cpu=AMD64 Family 25 Model 97 Stepping 2, AuthenticAMD system=Windows
                         release=Windows-10-10.0.22631-SP0 python=3.11.5
09:13:37-804050 INFO     Args: ['--use-zluda', '--reinstall']
09:13:37-811531 INFO     Python: version=3.11.5 platform=Windows bin="D:\sdnext\automatic\venv\Scripts\python.exe"
                         venv="D:\sdnext\automatic\venv"
09:13:37-813531 INFO     ROCm: AMD toolkit detected
09:13:38-566304 INFO     ROCm: agents=['gfx1100', 'gfx1036']
09:13:38-567304 INFO     ROCm: version=5.7, using agent gfx1100
09:13:38-567304 WARNING  ZLUDA support: experimental
09:44:25-926327 WARNING  Failed to install ZLUDA: <urlopen error retrieval incomplete: got only 7944809 out of 14711842
                         bytes>
09:44:25-927830 INFO     Using CPU-only torch
09:44:25-928835 INFO     Install: package="torch torchvision" mode=pip
09:45:21-999324 INFO     Install: package="onnx" mode=pip
09:45:29-593398 INFO     Install: package="onnxruntime" mode=pip
09:46:18-763400 WARNING  Modified files: ['_zluda', 'startup.cmd']
09:46:18-763400 INFO     Forcing reinstall of all packages
09:46:18-764400 INFO     Installing requirements: this may take a while...
09:48:25-276725 INFO     Verifying requirements
09:48:25-329188 INFO     Install: package="requests==2.32.3" mode=pip
09:48:26-862175 INFO     Verifying packages
09:48:26-862175 INFO     Install: package="git+https://github.com/openai/CLIP.git" mode=pip
09:48:36-629669 INFO     Install: package="open-clip-torch" mode=pip
09:48:37-777860 INFO     Startup: standard
09:48:37-778866 INFO     Verifying submodules
09:48:45-834812 INFO     Extension installed packages: sd-webui-agent-scheduler ['SQLAlchemy==2.0.36',
                         'greenlet==3.1.1']
09:48:53-416712 INFO     Extension installed packages: stable-diffusion-webui-rembg ['PyMatting==1.1.13',
                         'opencv-python-headless==4.10.0.84', 'pooch==1.8.2', 'rembg==2.0.59']
09:48:53-418730 INFO     Extensions enabled: ['Lora', 'sd-extension-chainner', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sdnext-modernui', 'stable-diffusion-webui-rembg']
09:48:53-418855 INFO     Installing requirements: this may take a while...
09:48:53-419859 INFO     Verifying requirements
09:48:53-423368 INFO     Command line args: ['--use-zluda', '--reinstall'] reinstall=True use_zluda=True
09:49:00-557993 INFO     System packages: {'torch': '2.5.1+cpu', 'diffusers': '0.32.0.dev0', 'gradio': '3.43.2',
                         'transformers': '4.46.1', 'accelerate': '1.0.1'}
09:49:01-314565 INFO     Engine: backend=Backend.DIFFUSERS compute=cpu device=cpu attention="Scaled-Dot-Product"
                         mode=no_grad
09:49:01-678807 INFO     Available Styles: folder="models\styles" items=288 time=0.36
09:49:01-687482 INFO     Torch parameters: backend=cpu device=cpu config=Auto dtype=torch.bfloat16 vae=torch.bfloat16
                         unet=torch.bfloat16 context=no_grad nohalf=False nohalfvae=False upscast=False
                         deterministic=False test-fp16=True test-bf16=True optimization="Scaled-Dot-Product"
09:49:01-688141 INFO     Device:
09:49:02-178656 INFO     Create: folder="outputs\text"
09:49:02-179299 INFO     Create: folder="outputs\image"
09:49:02-180302 INFO     Create: folder="outputs\control"
09:49:02-181302 INFO     Create: folder="outputs\extras"
09:49:02-182619 INFO     Create: folder="outputs\init-images"
09:49:02-183122 INFO     Create: folder="outputs\grids"
09:49:02-183650 INFO     Create: folder="outputs\save"
09:49:02-184654 INFO     Create: folder="outputs\video"
09:49:02-207181 INFO     Available VAEs: path="models\VAE" items=0
09:49:02-208186 INFO     Available UNets: path="models\UNET" items=0
09:49:02-209231 INFO     Available TEs: path="models\Text-encoder" items=0
09:49:02-210034 INFO     Disabled extensions: ['sdnext-modernui']
09:49:02-211538 INFO     Available Models: path="models\Stable-diffusion" items=0 time=0.00
09:49:02-213542 INFO     Install: package="basicsr" mode=pip
09:49:10-272282 INFO     Install: package="gfpgan" mode=pip
09:49:13-716474 INFO     Available Yolo: path="models\yolo" items=6 downloaded=0
09:49:13-775014 INFO     Available LoRAs: path="models\Lora" items=0 folders=2 time=0.00
09:49:14-376468 INFO     Extension: script='extensions-builtin\sd-webui-agent-scheduler\scripts\task_scheduler.py' Using
                         sqlite file: extensions-builtin\sd-webui-agent-scheduler\task_scheduler.sqlite3
09:49:14-412961 INFO     Available Upscalers: items=53 downloaded=0 user=0 time=0.03 types=['None', 'Lanczos',
                         'Nearest', 'ChaiNNer', 'AuraSR', 'ESRGAN', 'LDSR', 'RealESRGAN', 'SCUNet', 'SD', 'SwinIR']
09:49:14-429691 INFO     Available Styles: folder="models\styles" items=288 time=0.01
09:49:14-433695 INFO     UI theme: type=Standard name="black-teal"
09:49:14-503303 INFO     Install: package="clean-fid" mode=pip
09:49:17-466623 INFO     Extension list is empty: refresh required
09:49:18-181624 INFO     Local URL: http://127.0.0.1:7860/
09:49:18-287847 INFO     [AgentScheduler] Task queue is empty
09:49:18-289269 INFO     [AgentScheduler] Registering APIs
09:49:18-363484 WARNING  Cannot generate without a checkpoint
09:49:18-364485 INFO     Set system paths to use existing folders
09:49:18-364485 INFO       or use --models-dir <path-to-folder> to specify base folder with all models
09:49:18-365484 INFO       or use --ckpt-dir <path-to-folder> to specify folder with sd models
09:49:18-366484 INFO       or use --ckpt <path-to-checkpoint> to force using specific model
09:49:18-366484 INFO     Startup time: 24.94 torch=4.94 onnx=0.05 gradio=1.99 diffusers=0.06 libraries=1.69
                         extensions=0.66 detailer=11.51 ui-networks=0.10 ui-txt2img=2.33 ui-img2img=0.24 ui-control=0.09
                         ui-settings=0.19 ui-extensions=0.39 launch=0.30 api=0.05 app-started=0.13
14:04:28-533303 INFO     Browser session: user=None client=127.0.0.1 agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                         AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
14:04:34-388461 INFO     MOTD: N/A
14:05:53-513775 INFO     Settings: changed=1 ['ckpt_dir']
14:05:54-198278 ERROR    API error: GET: http://127.0.0.1:7860/file=html/themes.json {'error': 'HTTPException', 'code':
                         404, 'detail': 'File not found: html/themes.json.', 'body': '', 'errors': '404: File not found:
                         html/themes.json.'}
14:06:36-735874 INFO     Available Models: path="D:\sdnext\automatic\models\Diffusers" items=1 time=0.45
14:06:38-871835 INFO     Load model: select="v1-5-pruned-emaonly"
14:06:38-872835 INFO     Autodetect model: detect="Stable Diffusion" class=StableDiffusionPipeline
                         file="D:\sdnext\automatic\models\Diffusers\v1-5-pruned-emaonly.safetensors" size=4068MB
Diffusers  3.30it/s ████████ 100% 6/6 00:01 00:00 Loading pipeline components...
Calculating hash: D:\sdnext\automatic\models\Diffusers\v1-5-pruned-emaonly.safetensors ━━━━━━━━━━━━━━ 4.3/4.3 GB 0:00:00
14:06:43-759047 INFO     Load network: type=embeddings loaded=0 skipped=0 time=0.00
14:06:44-015892 INFO     Load model: time=4.92 load=4.89 native=512 memory={'ram': {'used': 2.5, 'total': 63.16}}
14:07:02-440191 INFO     Base: class=StableDiffusionPipeline
Progress 10.82s/it █████████████████████████████████ 100% 20/20 03:36 00:00 Base
14:10:47-004107 INFO     Save: image="outputs\text\00000-v1-5-pruned-emaonly-a dog.jpg" type=JPEG width=1024 height=1024
                         size=238060
14:10:47-009332 INFO     Processed: images=1 its=0.09 time=224.57 timers={'encode': 0.12, 'args': 0.24, 'pipeline':
                         216.37, 'decode': 7.92, 'post': 0.03} memory={'ram': {'used': 3.14, 'total': 63.16}}
vladmandic commented 1 week ago

09:44:25-926327 WARNING Failed to install ZLUDA: <urlopen error retrieval incomplete: got only 7944809 out of 14711842 bytes>

you need to investigate why is your network causing failures. if you want to install zluda manually, go ahead, but then we cannot help with any support issues.