ochen1 / insanely-fast-whisper-cli

The fastest Whisper optimization for automatic speech recognition as a command-line interface ⚡️
MIT License
318 stars 30 forks source link

Device=cpu bug. "Invalid device string: 'cuda:cpu'" #9

Open Brodski opened 6 months ago

Brodski commented 6 months ago

I'm on a windows machine. Not sure if that matters, but this command doesnt work:

Command: $ insanely-fast-whisper --model openai/whisper-base --device cpu --file-name myaudio.wav

Error:

C:\Users\BrodskiTheGreat\Desktop\desktop\Code\scraper-dl-vids\insanely-fast\venv\lib\site-packages\pyannote\audio\core\io.py:43: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
  torchaudio.set_audio_backend("soundfile")
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 "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\BrodskiTheGreat\Desktop\desktop\Code\scraper-dl-vids\insanely-fast\venv\Scripts\insanely-fast-whisper.exe\__main__.py", line 7, in <module>
  File "C:\Users\BrodskiTheGreat\Desktop\desktop\Code\scraper-dl-vids\insanely-fast\venv\lib\site-packages\insanely_fast_whisper\cli.py", line 94, in main
    pipe = pipeline(
  File "C:\Users\BrodskiTheGreat\Desktop\desktop\Code\scraper-dl-vids\insanely-fast\venv\lib\site-packages\transformers\pipelines\__init__.py", line 1108, in pipeline
    return pipeline_class(model=model, framework=framework, task=task, **kwargs)
  File "C:\Users\BrodskiTheGreat\Desktop\desktop\Code\scraper-dl-vids\insanely-fast\venv\lib\site-packages\transformers\pipelines\automatic_speech_recognition.py", line 220, in __init__
    super().__init__(model, tokenizer, feature_extractor, device=device, torch_dtype=torch_dtype, **kwargs)
  File "C:\Users\BrodskiTheGreat\Desktop\desktop\Code\scraper-dl-vids\insanely-fast\venv\lib\site-packages\transformers\pipelines\base.py", line 853, in __init__
    self.device = torch.device(device)
RuntimeError: Invalid device string: 'cuda:cpu'

Also when I run --device cuda:0 i get similar error RuntimeError: Invalid device string: 'cuda:cuda:0'

I'm not familiar with transformers's pipeline, but looks like it's messing up some string concatenation