Vaibhavs10 / insanely-fast-whisper

Apache License 2.0
7.51k stars 529 forks source link

Auto detect device id? #88

Open patrick91 opened 10 months ago

patrick91 commented 10 months ago

So, you can pass --device mps to make it work on mX macs, but I wonder if it wouldn't be nicer to automatically detect that? :)

JimmyLv commented 10 months ago

I actually specified --device mps and still get an error?

insanely-fast-whisper --file-name live-stream-jimmy.mp4 --device-id "mps"
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/jimmylv/.local/bin/insanely-fast-whisper", line 8, in <module>
    sys.exit(main())
  File "/Users/jimmylv/.local/pipx/venvs/insanely-fast-whisper/lib/python3.9/site-packages/insanely_fast_whisper/cli.py", line 86, in main
    pipe = pipeline(
  File "/Users/jimmylv/.local/pipx/venvs/insanely-fast-whisper/lib/python3.9/site-packages/transformers/pipelines/__init__.py", line 1070, in pipeline
    return pipeline_class(model=model, framework=framework, task=task, **kwargs)
  File "/Users/jimmylv/.local/pipx/venvs/insanely-fast-whisper/lib/python3.9/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 239, in __init__
    self.model.to(device)
  File "/Users/jimmylv/.local/pipx/venvs/insanely-fast-whisper/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2271, in to
    return super().to(*args, **kwargs)
  File "/Users/jimmylv/.local/pipx/venvs/insanely-fast-whisper/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1141, in to
    device, dtype, non_blocking, convert_to_format = torch._C._nn._parse_to(*args, **kwargs)
RuntimeError: Invalid device string: 'cuda:mps'