Open illtellyoulater opened 2 years ago
Seems to be related to this: https://github.com/pytorch/pytorch/issues/58123 and specifically to this: https://github.com/pytorch/pytorch/issues/58123#issuecomment-839579861
However I don't understand how this is possibile, given the bug documented at the link above is affecting cudnn releases before v8.2.2 while I'm using cudnn v8.3.0.2, which I verified by doing:
import torch torch.backends.cudnn.version() 8302
Any ideas?
I don't have much technical insight to add, but I have seen such samples (everything black) being generated occassionally while doing transfer learning on Colab using below implementation. https://github.com/afiaka87/glide-finetune
Ok I could finally make it work by installing a version of torch and torchvision coming with CUDA Toolkit v10.2
.
Specifically I downloaded torch-1.8.0-cp38-cp38-win_amd64.whl
and torchvision-0.9.0-cp38-cp38-win_amd64.whl
(which include CUDA v10.2 despite not having the a "cu###" suffix) from https://download.pytorch.org/whl/torch_stable.html and then I installed them with pip install filename.whl
.
In theory newer version of Torch should work too, provided they come with CUDA 10.2, eg:
pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 -f https://download.pytorch.org/whl/torch_stable.html
at least this was a requirement in my case...
I hope this workaround works for my user who is suffering from the same issue, but... it is a very cumbersome workaround, because pytorch download page says 10.2 is no longer supported, and also, CUDA 10.2 won't work on newer GPU's such as 2070 and above, meaning the users have to download a separate thing.
At least one other source that downgrading should work: https://discuss.pytorch.org/t/half-precision-convolution-cause-nan-in-forward-pass/117358/3
Wondering if anyone knows of a better workaround that doesn't involve downgrading CUDA version
(edit: Wait a sec, I just realized my torch version is only 8200. Will update with more comments)
@monsieurpooh I observed that in some other cases the following newer version also works for me:
pip3 install torch==1.11.0+cu115 torchvision==0.12.0+cu115 torchaudio===0.11.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html
does it work in your case?
Thanks for your input!
Updating above cuDNN 8.2.2 was sufficient to fix my issue even with cuda toolkit 11.3. It was not necessary to downgrade CUDA toolkit.
I have not tried installing with cuda toolkit 11.5. But presumably that may also work; maybe the torch that has cuda 11.5 also has cuDNN of higher than 8.2.2? I noticed the default torch 1.11 only had cuDNN 8.2 or so.
Same Problem here. (also same hardware) @monsieurpooh @illtellyoulater Unlike you guys, I have tried pytorch with cuda version 11.5 (whose cudnn version is 8.3.0>8.2.2) and also tried downloading cuDNN from nvidia and copy/paste the dll files into the relevant folder in torch/lib , the problem can not be solved.
Same happens while trying Stable Diffusion with autocast/fp16. The output is black no matter what I do. This is with pytorch 1.12.1 cuda 11.6 cudnn 8.0 on conda
Hello, For both "text2im.ipynb" and "clip_guided.ipynb" I'm seeing that the generated image is all black. This only happens in GPU mode (Nvidia GTX 1660 TI, 6 GB), while in CPU mode the image is generated correctly. I'm on Windows 10 using Python 3.8 and
torch-1.11.0+cu115 pypi_0 pypi torchvision-0.12.0+cu115 pypi_0 pypi
and this environment works fine for all other ML projects I'm running.
In "text2im.ipynb" I saw that tensor values become NaN in the model_fn function, when model() is called:
As I tried to track down the problem a bit further, I found that the values start getting wrong in the forward function of "text2im_model.py":
https://github.com/openai/glide-text2im/blob/69b530740eb6cef69442d6180579ef5ba9ef063e/glide_text2im/text2im_model.py#L123-L142
specifically at line 133, where module is called:
https://github.com/openai/glide-text2im/blob/69b530740eb6cef69442d6180579ef5ba9ef063e/glide_text2im/text2im_model.py#L133-L135
Here, at iteration # 2 some values become NaN and at iteration # 6 all values become NaN.
Please take a look:
As you can see at this point only some values have become NaN. This remain like so until iteration # 6, where, after the module call ALL values become NaN:
With my limited knowledge of this field this is all I could find. Please let me know if there some other info I can provide.