enlyth / sd-webui-riffusion

Riffusion extension for AUTOMATIC1111's SD Web UI
MIT License
195 stars 23 forks source link

AssertionError: Torch not compiled with CUDA enabled #3

Open StableInquest opened 1 year ago

StableInquest commented 1 year ago
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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Correction. torchaudio==0.12.1

aavetis commented 1 year ago

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

StableInquest commented 1 year ago

No luck so far.

enlyth commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

StableInquest commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

:)

angrysky56 commented 1 year ago

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 commented 10 months ago

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 commented 3 months ago

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