Vaibhavs10 / insanely-fast-whisper

Apache License 2.0
7.76k stars 547 forks source link

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

Open gjnave opened 4 months ago

gjnave commented 4 months ago

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 2) conda install -c nvidia cudatoolkit=11.8.0
2) pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Done.

dattachandan commented 4 months ago

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

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

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

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