text-generation-webui icon indicating copy to clipboard operation
text-generation-webui copied to clipboard

AssertionError: Torch not compiled with CUDA enabled

Open NavarroRefugee opened this issue 1 year ago • 35 comments

Describe the bug

After completing a fresh install using the windows one click installer, I am receiving the following error whenever I run the start_windows script:

AssertionError: Torch not compiled with CUDA enabled

Is there an existing issue for this?

  • [X] I have searched the existing issues

Reproduction

  1. Download current version of Windows one-click installer
  2. Install for NVIDIA system.
  3. Select any model.
  4. Attempt to run start_windows script

Screenshot

No response

Logs

`Traceback (most recent call last):
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\text-generation-webui\server.py", line 917, in <module>
	shared.model, shared.tokenizer = load_model(shared.model_name)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\text-generation-webui\modules\models.py", line 127, in load_model
	model = load_quantized(model_name)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\text-generation-webui\modules\GPTQ_loader.py", line 193, in load_quantized
	model = model.to(torch.device('cuda:0'))
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\transformers\modeling_utils.py", line 1896, in to
	return super().to(*args, **kwargs)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\torch\nn\modules\module.py", line 1145, in to
	return self._apply(convert)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\torch\nn\modules\module.py", line 797, in _apply
	module._apply(fn)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\torch\nn\modules\module.py", line 797, in _apply
	module._apply(fn)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\torch\nn\modules\module.py", line 820, in _apply
	param_applied = fn(param)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\torch\nn\modules\module.py", line 1143, in convert
	return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
  File "C:\Users\<user>\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\torch\cuda\__init__.py", line 239, in _lazy_init
	raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Done!
Press any key to continue . . .
`

System Info

Windows 11, NVIDIA GTX 4080

NavarroRefugee avatar Apr 20 '23 02:04 NavarroRefugee

same error

LuciEdits avatar Apr 20 '23 05:04 LuciEdits

Did u find a fix for it?

LuciEdits avatar Apr 20 '23 05:04 LuciEdits

Same error for me. Tried to run the update. Also shows the CUDA EnvironmentError. raise EnvironmentError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.

Carl611 avatar Apr 20 '23 06:04 Carl611

Same error, for windows 10 NVIDIA 3090, anybody have a clue?

julycamera avatar Apr 20 '23 08:04 julycamera

Same here trying to load the model : gpt-x-alpaca-13b-native-4bit-128g-cuda

installer_files\env\lib\site-packages\torch\cuda_init_.py", line 239, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

Ali-Kabbadj avatar Apr 20 '23 11:04 Ali-Kabbadj

Same

jdietzChina avatar Apr 21 '23 03:04 jdietzChina

I uninstalled Torch, and reinstalled the cuda toolkit. Then ran the update_windows batch file for oobabooga. And finally reinstalled torch.

That solved it... maybe overkill, but it worked.

jdietzChina avatar Apr 21 '23 04:04 jdietzChina

If any of you can still reproduce this issue, I'd like to fix it. Please perform a fresh install and send the entire install log. There should be an error in there which will help me pinpoint the issue.

xNul avatar Apr 21 '23 05:04 xNul

Same issue. During install it says "No CUDA runtime is found" and ends up with "CUDA kernal compilation failed"

Sinxain avatar Apr 21 '23 08:04 Sinxain

Same issue. During install it says "No CUDA runtime is found" and ends up with "CUDA kernal compilation failed"

@Sinxain If you can send the entire install log, I can look into it.

xNul avatar Apr 21 '23 08:04 xNul

Same issue. During install it says "No CUDA runtime is found" and ends up with "CUDA kernal compilation failed"

@Sinxain If you can send the entire install log, I can look into it.

New Text Document.txt

Sinxain avatar Apr 21 '23 10:04 Sinxain

@Sinxain thank you for this. I noticed for some reason the install is making references to a global Python and Pip install here c:\users\user\appdata\roaming\python\python310\site-packages when it should be using the Python install of the Miniconda environment. I think what's happening is that CUDA is being installed to the global system environment and is not accessible in the local Miniconda environment or vice versa.

The same error is happening here too https://github.com/oobabooga/one-click-installers/issues/26

I'll check it out

xNul avatar Apr 22 '23 02:04 xNul

Getting same issue on M1 Mac Studio

Download current version of Macos one-click installer Install for M1 or CPU. Select any model. Attempt to run start_macos script

Tried deleting/reinstalling several times.

greencat667 avatar Apr 23 '23 07:04 greencat667

Getting same issue on M1 Mac Studio

Download current version of Macos one-click installer Install for M1 or CPU. Select any model. Attempt to run start_macos script

Tried deleting/reinstalling several times.

Same on M2 Mac

omid3098 avatar Apr 23 '23 17:04 omid3098

So I solved this issue on Windows by removing a bunch of duplicate/redundant python installations in my environment path. I left only miniconda, and the only way to access python is via activating a conda environment.

I also made sure to delete any extraneous site-package folders from the other python installs because for some reason it was still looking for pytorch in them.

Finally I installed torch via the conda install method listed on the cuda website: https://pytorch.org/get-started/locally/

For example, mine was: conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia with my RTX3080.

Hope this helps people, or maybe lends some ideas on the installer checking for these sorts of conflicts?

NouberNou avatar Apr 24 '23 22:04 NouberNou

Getting same issue on win11!

andreiostanin avatar Apr 25 '23 19:04 andreiostanin

I've made some changes here which might fix this problem. If someone who still has this problem could check, I'd appreciate it

xNul avatar Apr 27 '23 06:04 xNul

I've made some changes here which might fix this problem. If someone who still has this problem could check, I'd appreciate it

It's now loading the webui on localhost:7860 which is great progress. Thank you!

But getting a different error when actually running a query "RuntimeError: MPS does not support cumsum op with int64 input" but not sure if that's related. The UI briefly displays "The assistant is typing..." and then text output area goes blank.

I'll try my Mac Studio with a different model later.

2020 M1 Macbook Air 8GB RAM. Pythia-410M-deduped. M1 option selected in menu during installation.

Details of error: Gradio HTTP request redirected to localhost :) bin /Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so /Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/bitsandbytes/cextension.py:33: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable. warn("The installed version of bitsandbytes was compiled without GPU support. " Loading EleutherAI_pythia-410m-deduped... Loaded the model in 2.14 seconds. Loading the extension "gallery"... Ok. Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). /Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/transformers/generation/utils.py:690: UserWarning: MPS: no support for int64 repeats mask, casting it to int32 (Triggered internally at /Users/runner/work/_temp/anaconda/conda-bld/pytorch_1678454852765/work/aten/src/ATen/native/mps/operations/Repeat.mm:236.) input_ids = input_ids.repeat_interleave(expand_size, dim=0) Traceback (most recent call last): File "/Users/xxxxxxxxxx/Downloads/one-click-installers-main/text-generation-webui/modules/callbacks.py", line 66, in gentask ret = self.mfunc(callback=_callback, **self.kwargs) File "/Users/xxxxxxxxxx/Downloads/one-click-installers-main/text-generation-webui/modules/text_generation.py", line 290, in generate_with_callback shared.model.generate(**kwargs) File "/Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/transformers/generation/utils.py", line 1485, in generate return self.sample( File "/Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/transformers/generation/utils.py", line 2521, in sample model_inputs = self.prepare_inputs_for_generation(input_ids, **model_kwargs) File "/Users/xxxxxxxxxx/Downloads/one-click-installers-main/installer_files/env/lib/python3.10/site-packages/transformers/models/gpt_neox/modeling_gpt_neox.py", line 710, in prepare_inputs_for_generation position_ids = attention_mask.long().cumsum(-1) - 1 RuntimeError: MPS does not support cumsum op with int64 input Output generated in 0.53 seconds (0.00 tokens/s, 0 tokens, context 38, seed 1967011890)

greencat667 avatar Apr 27 '23 07:04 greencat667

@greencat667 I don't know much about Pythia but it looks like other people have your error too. Any ggml or hf model should work though. I'm able to use https://huggingface.co/Drararara/llama-7b-ggml on my Intel-based Macbook for example.

xNul avatar Apr 27 '23 08:04 xNul

Same on M2 Macbook! UI opens successfully. But a slightly different error when trying to input a text:

Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/transformers/generation/utils.py:690: UserWarning: MPS: no support for int64 repeats mask, casting it to int32 (Triggered internally at /Users/runner/work/_temp/anaconda/conda-bld/pytorch_1678454852765/work/aten/src/ATen/native/mps/operations/Repeat.mm:236.)
  input_ids = input_ids.repeat_interleave(expand_size, dim=0)
Traceback (most recent call last):
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/text-generation-webui/modules/callbacks.py", line 66, in gentask
    ret = self.mfunc(callback=_callback, **self.kwargs)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/text-generation-webui/modules/text_generation.py", line 290, in generate_with_callback
    shared.model.generate(**kwargs)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/transformers/generation/utils.py", line 1485, in generate
    return self.sample(
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/transformers/generation/utils.py", line 2524, in sample
    outputs = self(
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/transformers/models/opt/modeling_opt.py", line 938, in forward
    outputs = self.model.decoder(
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/transformers/models/opt/modeling_opt.py", line 648, in forward
    pos_embeds = self.embed_positions(attention_mask, past_key_values_length)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/{user}/Documents/AI/oobabooga/one-click-installers/installer_files/env/lib/python3.10/site-packages/transformers/models/opt/modeling_opt.py", line 115, in forward
    positions = (torch.cumsum(attention_mask, dim=1).type_as(attention_mask) * attention_mask).long() - 1
RuntimeError: MPS does not support cumsum op with int64 input
Output generated in 2.02 seconds (0.00 tokens/s, 0 tokens, context 34, seed 1652130967)

omid3098 avatar Apr 27 '23 08:04 omid3098

@omid3098 what model did you use?

xNul avatar Apr 27 '23 08:04 xNul

the most lightweight one: D) OPT 350M Now tying with the one you linked!

Update: This model works fine https://huggingface.co/Drararara/llama-7b-ggml

omid3098 avatar Apr 27 '23 08:04 omid3098

awesome!

xNul avatar Apr 27 '23 09:04 xNul

That's working on my Mac Studio and is just fantastic. Thanks @xNul

greencat667 avatar Apr 27 '23 09:04 greencat667

No change for me. Still getting the same errors

Sinxain avatar Apr 27 '23 14:04 Sinxain

@Sinxain can you try a different model like https://huggingface.co/wcde/llama-7b-4bit-gr128?

xNul avatar Apr 27 '23 16:04 xNul

Seems to be working now. I uninstalled python and deleted the python folder in AppData. Installed oobabooga using the one-click installer from the official page and its working. My guess that folder in AppData was the culprit.

Sinxain avatar Apr 27 '23 17:04 Sinxain

Ignoring bitsandbytes: markers 'platform_system != "Windows"' don't match your environment Ignoring llama-cpp-python: markers 'platform_system != "Windows"' don't match your environment

Getting the Errors above when trying to install with this command: "install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia"

running on Windows 11 so I don´t know why it won´t work, or even uses env instead of venv like 90% of the other AI stuff out there...

TripleKiller666 avatar May 03 '23 04:05 TripleKiller666

@TripleKiller666 that is a warning, not an error. If you didn't receive an error during installation, there should be no problem with it and you should be set to run a model.

We won't be changing to venv anytime soon unless there is some benefit?

xNul avatar May 03 '23 04:05 xNul

Dunno about any other benefit than it installing all the Cuda stuff properly on Windows. Even with the "fixed" installer Files I get these Errors:

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8' running install G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_ext G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\torch\utils\cpp_extension.py:358: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden warnings.warn(f'Error checking compiler version for {compiler}: {error}') Traceback (most recent call last): File "", line 2, in File "", line 34, in File "G:\AI_STUFF\ooga2\one-click-installers-main\text-generation-webui\repositories\GPTQ-for-LLaMa\setup.py", line 4, in setup( File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_init_.py", line 87, in setup return distutils.core.setup(**attrs) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools\command\install.py", line 68, in run return orig.install.run(self) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\command\install.py", line 698, in run self.run_command('build') File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\command\build.py", line 132, in run self.run_command(cmd_name) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools\command\build_ext.py", line 84, in run _build_ext.run(self) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\setuptools_distutils\command\build_ext.py", line 346, in run self.build_extensions() File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\torch\utils\cpp_extension.py", line 499, in build_extensions _check_cuda_version(compiler_name, compiler_version) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\torch\utils\cpp_extension.py", line 382, in _check_cuda_version torch_cuda_version = packaging.version.parse(torch.version.cuda) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\pkg_resources_vendor\packaging\version.py", line 49, in parse return Version(version) File "G:\AI_STUFF\ooga2\one-click-installers-main\installer_files\env\lib\site-packages\pkg_resources_vendor\packaging\version.py", line 264, in init match = self._regex.search(version) TypeError: expected string or bytes-like object [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> quant-cuda

note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure. ERROR: GPTQ CUDA kernel compilation failed. Attempting installation with wheel. Collecting quant-cuda==0.0.0 Downloading https://github.com/jllllll/GPTQ-for-LLaMa-Wheels/raw/main/quant_cuda-0.0.0-cp310-cp310-win_amd64.whl (398 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 398.4/398.4 kB 3.5 MB/s eta 0:00:00 Installing collected packages: quant-cuda Successfully installed quant-cuda-0.0.0

TripleKiller666 avatar May 03 '23 04:05 TripleKiller666