ru-dalle icon indicating copy to clipboard operation
ru-dalle copied to clipboard

How to generate only 1 image? cuDNN error: CUDNN_STATUS_INTERNAL_ERROR

Open Migsie123 opened this issue 4 years ago • 4 comments

Setting images_num or bs to 1 results in following error

Exception has occurred: RuntimeError (note: full exception trace is shown but execution is paused at: _run_module_as_main) cuDNN error: CUDNN_STATUS_INTERNAL_ERROR File "D:\Software\Python39\Lib\site-packages\torch\nn\modules\conv.py", line 442, in _conv_forward return F.conv2d(input, weight, bias, self.stride, File "D:\Software\Python39\Lib\site-packages\torch\nn\modules\conv.py", line 446, in forward return self._conv_forward(input, self.weight, self.bias) File "D:\Software\Python39\Lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "D:\Software\Python39\Lib\site-packages\rudalle\vae\model.py", line 98, in decode quant = self.post_quant_conv(quant) File "D:\Software\Python39\Lib\site-packages\rudalle\vae\model.py", line 38, in decode img = self.model.decode(z)

Migsie123 avatar Nov 05 '21 10:11 Migsie123

Hi, you can try something like this:

for top_k, top_p, images_num in [(128, 0.95, 1)]:

gwaxG avatar Nov 06 '21 01:11 gwaxG

Hey,

Sorry for not being more specific in the first post, but that is pretty much exactly what I tried.

Heres my full code:

from rudalle.pipelines import generate_images, show, super_resolution, cherry_pick_by_clip
from rudalle import get_rudalle_model, get_tokenizer, get_vae, get_realesrgan, get_ruclip
from rudalle.utils import seed_everything

device = 'cuda'
dalle = get_rudalle_model('Malevich', pretrained=True, fp16=True, device=device)
realesrgan = get_realesrgan('x4', device=device)
tokenizer = get_tokenizer()
vae = get_vae().to(device)
ruclip, ruclip_processor = get_ruclip('ruclip-vit-base-patch32-v5')
ruclip = ruclip.to(device)

text = 'изображение радуги на фоне ночного города'

seed_everything(42)
pil_images = []
scores = []
for top_k, top_p, images_num in [(128, 0.95, 1)]:
    _pil_images, _scores = generate_images(text, tokenizer, dalle, vae, top_k=top_k, images_num=images_num, top_p=top_p)
    pil_images += _pil_images
    scores += _scores

for i, img in enumerate(pil_images):
    img.save(str(i)+".jpg")

and it gives the same error as above:

Exception has occurred: RuntimeError (note: full exception trace is shown but execution is paused at: _run_module_as_main) cuDNN error: CUDNN_STATUS_INTERNAL_ERROR File "D:\Software\Python39\Lib\site-packages\torch\nn\modules\conv.py", line 442, in _conv_forward return F.conv2d(input, weight, bias, self.stride, File "D:\Software\Python39\Lib\site-packages\torch\nn\modules\conv.py", line 446, in forward return self._conv_forward(input, self.weight, self.bias) File "D:\Software\Python39\Lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "D:\Software\Python39\Lib\site-packages\rudalle\vae\model.py", line 98, in decode quant = self.post_quant_conv(quant) File "D:\Software\Python39\Lib\site-packages\rudalle\vae\model.py", line 38, in decode img = self.model.decode(z)

Anything greater than 1 in images_num works great.

Migsie123 avatar Nov 06 '21 10:11 Migsie123

@migsmurai I suppose you met this error because your GPU has not enough gRAM for VAE decoding. You can try this example, it should help:

GPU 3.5Gb vRAM https://github.com/sberbank-ai/ru-dalle/pull/51

Open In Colab

or Jupyter version:

shonenkov avatar Nov 10 '21 15:11 shonenkov

For gpu with 4 Gb, now better generate 1 image with new version of jupyter notebook after #57

AndrewTrefilov avatar Nov 12 '21 14:11 AndrewTrefilov