d8ahazard / sd_dreambooth_extension

Other
1.87k stars 283 forks source link

use gpu-1, but check gpu-0 memory #1118

Closed silviayc closed 1 year ago

silviayc commented 1 year ago

HW: V100S x2 has use set CUDA_VISIBLE_DEVICES=1

Traceback:

OOM Detected, reducing batch/grad size to 10/1.
Traceback (most recent call last):
  File "D:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 119, in decorator
    return function(batch_size, grad_size, prof, *args, **kwargs)
  File "D:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 1229, in inner_loop
    noise_pred = unet(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\accelerate\utils\operations.py", line 495, in __call__
    return convert_to_fp32(self.model_forward(*args, **kwargs))
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\amp\autocast_mode.py", line 14, in decorate_autocast
    return func(*args, **kwargs)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\unet_2d_condition.py", line 631, in forward
    sample = upsample_block(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\unet_2d_blocks.py", line 1813, in forward
    hidden_states = attn(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\transformer_2d.py", line 265, in forward
    hidden_states = block(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\attention.py", line 291, in forward
    attn_output = self.attn1(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\cross_attention.py", line 205, in forward
    return self.processor(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\cross_attention.py", line 463, in __call__
    hidden_states = attn.to_out[0](hidden_states)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\stable-diffusion-webui\extensions\sd_dreambooth_extension\lora_diffusion\lora.py", line 35, in forward
    + self.lora_up(self.dropout(self.lora_down(input))) * self.scale
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 56.00 MiB (GPU 0; 31.87 GiB total capacity; 30.59 GiB already allocated; 31.13 MiB free; 30.65 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
ArrowM commented 1 year ago

You ran out of VRAM, follow the template.