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

This is how you solve "Torch installed w/out Cuda" error #236

Open
gjnave opened this issue Jul 14, 2024 · 4 comments
Open

This is how you solve "Torch installed w/out Cuda" error #236

gjnave opened this issue Jul 14, 2024 · 4 comments

Comments

@gjnave
Copy link

gjnave commented Jul 14, 2024

It's a procedural issue. The problem is that you have to install the cuda toolkit first:

  1. conda create --name ifw
  2. activate ifw
  3. conda config --append channels nvidia
  4. conda install -c nvidia cudatoolkit=11.8.0
  5. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Done.

@dattachandan
Copy link

Did this fix for you?

Followed the above but got this error:

python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Looking in indexes: https://download.pytorch.org/whl/cu121
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

while trying this

insanely-fast-whisper --file-name /Volumes/20220/cit/2024-07-22-kow.wav 
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
  File "/Users/cd/.local/bin/insanely-fast-whisper", line 8, in <module>
    sys.exit(main())
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/insanely_fast_whisper/cli.py", line 130, in main
    pipe = pipeline(
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/transformers/pipelines/__init__.py", line 1097, in pipeline
    return pipeline_class(model=model, framework=framework, task=task, **kwargs)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 219, in __init__
    super().__init__(model, tokenizer, feature_extractor, device=device, torch_dtype=torch_dtype, **kwargs)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/transformers/pipelines/base.py", line 894, in __init__
    self.model.to(self.device)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2796, in to
    return super().to(*args, **kwargs)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1173, in to
    return self._apply(convert)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
    module._apply(fn)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
    module._apply(fn)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
    module._apply(fn)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/nn/modules/module.py", line 804, in _apply
    param_applied = fn(param)
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1159, in convert
    return t.to(
  File "/Users/cd/.local/pipx/venvs/insanely-fast-whisper/lib/python3.10/site-packages/torch/cuda/__init__.py", line 284, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

@gjnave
Copy link
Author

gjnave commented Jul 22, 2024

you must have Cuda installed on the system.. and be sure to be in the virtual environment

go to terminal and type nvidia-smi
that will check that you have the drivers installed. If it doesnt recognize then you dont have the driver installed.

Then type nvcc --version
this will check if cudatoolkit is installed. It it cant finf then cudatoolkit is not installed.

If they do run the check the versions. if yuo have 11.8 installed then 12.1 wont work. if that is the case you need to do
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Here's a real easy and understandable tutorial to check your CUDA:
https://youtu.be/_GpyoEbs3Hs

@dattachandan
Copy link

Great thanks, I was trying without CUDA as the title of the thread said "without", else I am mistaken. Just trying this on Apple Silicon

@gjnave
Copy link
Author

gjnave commented Jul 23, 2024

Great thanks, I was trying without CUDA as the title of the thread said "without", else I am mistaken. Just trying this on Apple Silicon

oh .. lol that was mean to be all part of the error text. Glad it worked!
I walk new users through this stuff step by step at my youtube site. Im certain you'd find something helpful
www.youtube.com/@cognibuild

@gjnave gjnave changed the title This is how you solve Torch installed w/out Cude This is how you solve "Torch installed w/out Cuda" error Jul 23, 2024
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

2 participants