mirror of
https://github.com/openai/whisper.git
synced 2025-11-27 07:48:45 +00:00
Add hpu_utils
This commit is contained in:
parent
9269b2ac35
commit
52062dd798
15
whisper/hpu_utils.py
Normal file
15
whisper/hpu_utils.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import warnings
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
|
|
||||||
|
def load_default_hpu() -> str:
|
||||||
|
"""
|
||||||
|
Load HPU if available, otherwise use CUDA or CPU.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not torch.hpu.is_available():
|
||||||
|
warnings.warn("HPU is not available; trying to use CUDA instead.")
|
||||||
|
return "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
|
|
||||||
|
return "hpu"
|
||||||
Loading…
x
Reference in New Issue
Block a user