thygate / stable-diffusion-webui-depthmap-script

High Resolution Depth Maps for Stable Diffusion WebUI
MIT License
1.7k stars 160 forks source link

Not utilizing the GPU at all, but hammering away on CPU regardless of settings #408

Open Rudolph2109 opened 7 months ago

Rudolph2109 commented 7 months ago

My RTX 4070 TI is being utilized by 0% while my 12700K is working very hard whenever I generate anything from the program. This is regardless of I set it to use the GPU or the CPU, and I even forced the utilization of the GPU through windows graphics settings, by adding my browser to the list, just to make sure it wasn't a Windows issue. Skærmbillede 2024-02-14 150436

leonkhoo123 commented 5 months ago

I encoutered same issue, its due the pytorch version.

But first make sure u installed nvidia cuda toolkit , can be check by using

nvcc --version

if prompt command not found, u need to install from here : https://developer.nvidia.com/cuda-downloads after installing, try to run the testing code below :

import torch
torch.zeros(1).cuda()

if it show something like : tensor([0.], device='cuda:0') means your gpu cuda should be working now.

if prompt error, depending on the error u might need to find your own solution.

Mine is due to the pytorch installed do not compiled with cuda. So, i uninstall the pytorch first with pip uninstall torch torchvision then depending on your cuda version, check using nvidia-smi download the respective pytorch from here: https://pytorch.org/ after installing, try to run the cuda testing code again. If it dint show error, u should be able to use GPU now.

TijuanaKez commented 3 months ago

I'm getting this too. Console says device:cuda, but nvtop shows it's not being used, but CPU %100, then it usually crashes.

Loading VAE weights specified in settings: /mnt/AI/stable-diffusion-webui/models/VAE/sdxl-fp16.vae.safetensors
Applying attention optimization: Doggettx... done.
Model loaded in 3.7s (load weights from disk: 0.9s, create model: 0.4s, apply weights to model: 2.1s).
DepthMap v0.4.7 (ee54b550)
device: cuda
Loading model(s) ..
Loading model weights from  ./models/leres/res101.pth
initialize network with normal
loading the model from ./models/pix2pix/latest_net_G.pth
Computing output(s) ..
  0%|                                                              | 0/1 [00:00<?, ?it/s]wholeImage being processed in : 1568
Adjust factor is: 1.024247491638796
Selecting patches ...
Target resolution:  (3212, 2198, 3)
Resulting depthmap resolution will be : (4864, 3328)
patches to process: 19
     processing patch 0 / 18 | [  73   73 3247 3247]
     processing patch 1 / 18 | [  73  581 3247 3247]
     processing patch 2 / 18 | [ 145 1163 3101 3101]
     processing patch 3 / 18 | [ 485 2011 2423 2423]
     processing patch 4 / 18 | [   0    0 2374 2374]
     processing patch 5 / 18 | [   0  509 2374 2374]
     processing patch 6 / 18 | [   0 1018 2374 2374]
     processing patch 7 / 18 | [   0 1526 2374 2374]
     processing patch 8 / 18 | [ 509    0 2374 2374]
     processing patch 9 / 18 | [1090   73 2229 2229]
     processing patch 10 / 18 | [1090  581 2229 2229]
     processing patch 11 / 18 | [1090 1090 2229 2229]
     processing patch 12 / 18 | [1090 1599 2229 2229]
     processing patch 13 / 18 | [ 170 2205 2035 2035]
     processing patch 14 / 18 | [   0  509 1357 1357]
     processing patch 15 / 18 | [   0 2544 1357 1357]
     processing patch 16 / 18 | [ 509    0 1357 1357]
     processing patch 17 / 18 | [1018    0 1357 1357]
     processing patch 18 / 18 | [1526    0 1357 1357]
100%|██████████████████████████████████████████████████████| 1/1 [00:16<00:00, 16.69s/it]
Computing output(s) done.
Running 3D Photo Inpainting .. 
Loading edge model ..
Loading depth model ..
Loading rgb model ..
  0%|                                                                                                                                          | 0/1 [00:00<?, ?it/s]
Generating inpainted mesh .. (go make some coffee) ..
                                                                                                                                                           ./webui.sh: line 297:  7383 Killed                  "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"                                         | 0/7 [00:00<?, ?it/s]

PyTorch 2.3.0. Torch is working fine on my 3090 for generating images inside A1111.

Version: 2.3.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3