lucidrains / big-sleep

A simple command line tool for text to image generation, using OpenAI's CLIP and a BigGAN. Technique was originally created by https://twitter.com/advadnoun
MIT License
2.57k stars 304 forks source link

CUDA must be available in order to use Big Sleep #80

Open calebrader opened 3 years ago

calebrader commented 3 years ago

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Sun_Feb_14_22:08:44_Pacific_Standard_Time_2021 Cuda compilation tools, release 11.2, V11.2.152 Build cuda_11.2.r11.2/compiler.29618528_0

wolfgangmeyers commented 3 years ago

I ran into this on windows. I had to custom install pytorch from this page: https://pytorch.org/get-started/locally/

KiudLyrl commented 3 years ago

yeah same, you have to install pytorch before doing pip install big_sleep

jimleonardo commented 3 years ago

I ran into this on windows. I had to custom install pytorch from this page: https://pytorch.org/get-started/locally/

This is what I needed to do with a GeForce RTX 2070. I installed CUDA 10.2 for now because it seemed surest bet just to get up and running. Now big-sleep is generating for me.

meltingscales commented 2 years ago

I ran into this on windows. I had to custom install pytorch from this page: https://pytorch.org/get-started/locally/

This is what I needed to do with a GeForce RTX 2070. I installed CUDA 10.2 for now because it seemed surest bet just to get up and running. Now big-sleep is generating for me.

Windows 11 Pro, Lenovo Legion 82JY Laptop, RTX 3060 GPU here. Running CUDA 11.4:

C:\Users\henryfbp> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Aug_15_21:18:57_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.4, V11.4.120
Build cuda_11.4.r11.4/compiler.30300941_0

I did this, by running conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge. I had to:

Although now I get a new problem:

C:\Users\henryfbp> dream happy sheep
Key already registered with the same priority: GroupSpatialSoftmax
meltingscales commented 2 years ago

I have tunnel vision -- I installed the wrong version of cudatoolkit. I want 11.4 (from nvcc --versiont), not 11.1. 😝

Planning to run this. Will edit comment when conda install finally finishes.

conda list --revisions
conda install --revision 0
# (or in my case, literally reinstall anaconda because it's faster)
conda install pytorch torchvision torchaudio cudatoolkit=11.4 -c pytorch -c conda-forge
pip install big-sleep
dream happy sheep

EDIT: cudatoolkit=11.4 fails to install. I decided to install cudatoolkit=11.1 and it throws RuntimeError: CUDA out of memory. I was going to install older CUDA from https://developer.nvidia.com/cuda-11.1.1-download-archive but it didn't fix it.

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
pip install big-sleep
dream happy sheep

EDIT: Got it to work by using --num-cutouts=16 --image-size=128 from https://github.com/lucidrains/big-sleep/issues/99

ThatOneCalculator commented 2 years ago

Make sure you're on Python 3.8 btw, 3.9 & 3.10 don't work.

halr9000 commented 2 years ago

Make sure you're on Python 3.8 btw, 3.9 & 3.10 don't work.

Not sure if it was me reinstalling cuda or bumping down to Python 3.8 which finally worked. Do we know why, or do you have a reference for that @ThatOneCalculator ?

ThatOneCalculator commented 2 years ago

Make sure you're on Python 3.8 btw, 3.9 & 3.10 don't work.

Not sure if it was me reinstalling cuda or bumping down to Python 3.8 which finally worked. Do we know why, or do you have a reference for that @ThatOneCalculator ?

It's because Python 3.9 broke the cuda package.

illtellyoulater commented 2 years ago

What worked for me on Windows was:

Hope it helps

calebrader commented 2 years ago

How do I install Conda for Python 3.8 ?

illtellyoulater commented 2 years ago

How do I install Conda for Python 3.8 ?

Just download the full Conda distribution from here https://www.anaconda.com/products/individual

There could be ways to add Conda to an already working Python env but the above approach will work more consistently I believe.

calebrader commented 2 years ago

How do I get rid of python 3.9?

(bigsleep) C:\Users\caleb>py --version
Python 3.9.7

(bigsleep) C:\Users\caleb>
meltingscales commented 2 years ago

How do I get rid of python 3.9?

(bigsleep) C:\Users\caleb>py --version
Python 3.9.7

(bigsleep) C:\Users\caleb>

I think you might be in a virtual env, you can run where.exe py to see where the py command/exe comes from. I use Pipenv so I only know pipenv --py to show environment info. Perhaps conda(?) has a similar command.

calebrader commented 2 years ago

How do I install Conda for Python 3.8 ?

Just download the full Conda distribution from here https://www.anaconda.com/products/individual

This doesn't work. The "full Conda distribution" currently uses Python 3.9 which breaks Cuda and prevents Big Sleep from running.

meltingscales commented 2 years ago

How do I install Conda for Python 3.8 ?

Just download the full Conda distribution from here https://www.anaconda.com/products/individual

This doesn't work. The "full Conda distribution" currently uses Python 3.9 which breaks Cuda and prevents Big Sleep from running.

Maybe you could try an older Conda release? I will check what version I have on the windows laptop running CUDA.

halr9000 commented 2 years ago

Quoting @calebrader:

This doesn't work. The "full Conda distribution" currently uses Python 3.9 which breaks Cuda and prevents Big Sleep from running.

You are in luck, conda handles package management even of Python itself, and @illtellyoulater actually provides an answer above that shows this in action.

Look at the conda docs where they explain in more detail.

tl;dr re-read his message and try that. The line that does the trick is this one:

conda create --name bigsleep python=3.8