Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: Torch not compiled with CUDA enabled #3

Open
StableInquest opened this issue Dec 17, 2022 · 16 comments
Open

AssertionError: Torch not compiled with CUDA enabled #3

StableInquest opened this issue Dec 17, 2022 · 16 comments

Comments

@StableInquest
Copy link

Generating Riffusion mp3
100%| 20/20 [00:14<00:00,  1.42it/s]
Error completing request:17,  1.34it/s]                                                                                                                                                                                                                                                              
Arguments: ('mozart', '', 'None', 'None', 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 0, 0, 5, False, False, False, False, '', 1, '', 0, '', True, False, False, 'Not set', True, True, '', '', '', '', '', 1.3, 'Not set', 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', False, 'None', True, True, '//stable-diffusion-webui/outputs/sd-webui-riffusion/', 'Refresh Inline Audio (Last Batch)', None, None, None, None, None, None, None, None) {}
Traceback (most recent call last):
  File "//stable-diffusion-webui/modules/call_queue.py", line 45, in f
    res = list(func(*args, **kwargs))
  File "//stable-diffusion-webui/modules/call_queue.py", line 28, in f
    res = func(*args, **kwargs)
  File "//stable-diffusion-webui/modules/txt2img.py", line 46, in txt2img
    processed = modules.scripts.scripts_txt2img.run(p, *args)
  File "//stable-diffusion-webui/modules/scripts.py", line 328, in run
    processed = script.run(p, *script_args)
  File "//stable-diffusion-webui/extensions/sd-webui-riffusion/scripts/riffusion.py", line 129, in run
    wav_bytes, duration_s = self.wav_bytes_from_spectrogram_image(
  File "//stable-diffusion-webui/extensions/sd-webui-riffusion/scripts/riffusion.py", line 180, in wav_bytes_from_spectrogram_image
    samples = self.waveform_from_spectrogram(
  File "//stable-diffusion-webui/extensions/sd-webui-riffusion/scripts/riffusion.py", line 285, in waveform_from_spectrogram
    Sxx_torch = torch.from_numpy(Sxx).to(device)
  File "//stable-diffusion-webui/modules/devices.py", line 116, in tensor_to_fix
    return orig_tensor_to(self, *args, **kwargs)
  File "//stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/cuda/__init__.py", line 211, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

latest issue

@StableInquest
Copy link
Author

StableInquest commented Dec 17, 2022

Initial image generation seems to work though, just fails with the error I posted above. Image output for reference:
00034-550163201-mozart52ui9gc0. Prompt: "mozart"

@enlyth
Copy link
Owner

enlyth commented Dec 17, 2022

Which versions of torch, torchvision and torchaudio do you have installed if you run pip list in the python virtual environment?

(To activate the virtual environment, run the \stable-diffusion-webui\venv\Scripts\activate.bat in a command prompt, assuming Windows)

@StableInquest
Copy link
Author

Actually on M1 Mac. torch==1.12.1 torchvision==0.13.1 torchaudio==0.13.1, Python 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)]

@StableInquest
Copy link
Author

Correction. torchaudio==0.12.1

@aavetis
Copy link

aavetis commented Dec 18, 2022

uninstall torch libraries and install from with these instructions instead of using pip

@StableInquest
Copy link
Author

No luck so far.

@enlyth
Copy link
Owner

enlyth commented Dec 18, 2022

I think the problem is that my script tries to install the CUDA version (of torchaudio) automatically at each startup, since I forgot about MacOS. Then it complains that your main torch installation has not been compiled with CUDA, which is correct

Hopefully my latest commit should address this

@StableInquest
Copy link
Author

I deleted automatic SD install and did a clean install to try this from scratch. Unfortunatley still getting this same error.
Screenshot 2022-12-17 at 8 27 03 PM

@enlyth
Copy link
Owner

enlyth commented Dec 19, 2022

Sorry to hear you're still having issues, unfortunately I don't have a personal M1 Mac so it's hard for me to diagnose this problem

@StableInquest
Copy link
Author

No problem at all. If I can be of any assitance testing on Mac just let me know. Happy to help.

@StableInquest
Copy link
Author

Ok if you change :
device: str = "cuda:0",
to
device: str = "cpu:0",

if Mac is detected in the riffusion.py file that fixes it.

@enlyth
Copy link
Owner

enlyth commented Dec 20, 2022

Ok if you change : device: str = "cuda:0", to device: str = "cpu:0",

if Mac is detected in the riffusion.py file that fixes it.

Nice catch! I didn't notice the function defaults to trying to use a cuda device. That's what I get for copying someone else's code without reading it.

I will issue a fix based on your observation later today, glad to see you've found the fix

@StableInquest
Copy link
Author

:)

@angrysky56
Copy link

After the update on amd64 installing the module removes gpu use ability by installing a wrong version of cudnn for me. Complete reinstall without riffusion fixed the issue.

@Diamondturtle99
Copy link

Same error. @aavetis fix seems to be for normal use for an NVIDIA gpu, I use an AMD with the directml version of SD. Please help

@Annapichnenko
Copy link

Windows 11, stable diffusion 1.8 или 1.5, nvideo 3070, получаю эту же ошибку

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants