UnstableFusion icon indicating copy to clipboard operation
UnstableFusion copied to clipboard

Any prompt "Torch not compiled with CUDA enabled"

Open ffdown opened this issue 2 years ago • 11 comments

Fetching 16 files: 100%|█████████████████████████████████████████████████████████████| 16/16 [00:00<00:00, 3181.27it/s] Traceback (most recent call last): File "unstablefusion.py", line 889, in handle_inpaint_button inpainted_image = self.get_handler().inpaint(prompt, File "unstablefusion.py", line 436, in get_handler return self.stable_diffusion_manager.get_handler() File "unstablefusion.py", line 318, in get_handler return self.get_local_handler(self.get_huggingface_token()) File "unstablefusion.py", line 301, in get_local_handler self.cached_local_handler = StableDiffusionHandler(token) File "E:\AI\SD\SDUI\UnstableFusion-main\diffusionserver.py", line 27, in init self.text2img = StableDiffusionPipeline.from_pretrained( File "e:\Anaconda3\envs\ldm\lib\site-packages\diffusers\pipeline_utils.py", line 179, in to module.to(torch_device) File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 907, in to return self._apply(convert) File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 578, in _apply module._apply(fn) File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 578, in _apply module._apply(fn) File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 578, in _apply module._apply(fn) [Previous line repeated 1 more time] File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 601, in apply param_applied = fn(param) File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 905, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) File "e:\Anaconda3\envs\ldm\lib\site-packages\torch\cuda_init.py", line 210, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

ffdown avatar Oct 08 '22 18:10 ffdown

As the title suggests, you need to install pytorch with cuda enabled (after installing cuda itself of course).

ahrm avatar Oct 08 '22 19:10 ahrm

cuda installed, pytorch too... I don't understand anything( automatic111 works fine

ffdown avatar Oct 09 '22 00:10 ffdown

It is not enough for pytorch and cuda to be installed. You need to install the cuda version of pytorch. Automatic111 creates its own virtual environment, so it doesn't affect your global python installation.

ahrm avatar Oct 09 '22 10:10 ahrm

command for conda please, anyone combination not work

ffdown avatar Oct 09 '22 20:10 ffdown

I have the exact same issue, it's saddening that no ones is helping https://www.youtube.com/watch?v=GMSjDTU8Zlc&list=LL&index=1 (followed this tutorial to install Pytorch's Cuda)

I have cuda, pytorch, and the Pytorch's version of cuda installed, and yet I run into the exact same issue

raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

Kamekos avatar Oct 18 '22 10:10 Kamekos

In order to test if you have pytorch with cuda available, you can run the python command and then enter:

import torch
print(torch.cuda.is_available())

Note that the tutorial video that you linked creates a virtual environment, so you only have torch within that virtual environment.

ahrm avatar Oct 18 '22 10:10 ahrm

In order to test if you have pytorch with cuda available, you can run the python command and then enter:

import torch
print(torch.cuda.is_available())

Note that the tutorial video that you linked creates a virtual environment, so you only have torch within that virtual environment.

Oh my bad, it's indeed telling me that cuda isn't installed while running this command

How do you install cuda for pytorch that can be used anywhere ?

Kamekos avatar Oct 18 '22 10:10 Kamekos

Don't create a new environment, install it globally, or alternatively you can switch to the environment that you created in visual studio and presumably already has torch installed.

ahrm avatar Oct 18 '22 11:10 ahrm

I've just installed it globally, and I still run into the same issue, it appears fine in the pip list command too

Kamekos avatar Oct 18 '22 11:10 Kamekos

Ok so I've just found out I had the cpu version installed while running the print(torch.version) command for whatever reason, I will try uninstalling it and re install the gpu one

Kamekos avatar Oct 18 '22 12:10 Kamekos

It is not enough for pytorch and cuda to be installed. You need to install the cuda version of pytorch. Automatic111 creates its own virtual environment, so it doesn't affect your global python installation.

How do you do that? Please give pip or conda examples.

calebrader avatar Nov 24 '22 03:11 calebrader