Skip to content

Commit

Permalink
fixed "mps" for load_hf_whisper()
Browse files Browse the repository at this point in the history
-fixed `get_device()` returning `True` instead of "mps" when mps is available causing (#307)
  • Loading branch information
jianfch committed Feb 11, 2024
1 parent 133f323 commit 53272cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stable_whisper/whisper_word_level/hf_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def get_device(device: str = None) -> str:
return device
if torch.cuda.is_available():
return 'cuda:0'
if (mps := getattr(torch.backends, 'mps', None)) is not None:
return mps.is_available()
if (mps := getattr(torch.backends, 'mps', None)) is not None and mps.is_available():
return 'mps'
return 'cpu'


Expand Down

0 comments on commit 53272cb

Please sign in to comment.