mirror of
https://github.com/openai/whisper.git
synced 2025-11-27 15:54:00 +00:00
Merge 888dd61cba8a054224d3b743e6350a2e6ad4fc5f into c0d2f624c09dc18e709e37c2ad90c039a4eb72a2
This commit is contained in:
commit
9e47e36591
@ -517,6 +517,13 @@ def transcribe(
|
||||
def cli():
|
||||
from . import available_models
|
||||
|
||||
if torch.cuda.is_available():
|
||||
default_device = "cuda"
|
||||
elif hasattr(torch.backends, 'mps') and torch.backends.mps.is_available():
|
||||
default_device = "mps"
|
||||
else:
|
||||
default_device = "cpu"
|
||||
|
||||
def valid_model_name(name):
|
||||
if name in available_models() or os.path.exists(name):
|
||||
return name
|
||||
@ -529,7 +536,7 @@ def cli():
|
||||
parser.add_argument("audio", nargs="+", type=str, help="audio file(s) to transcribe")
|
||||
parser.add_argument("--model", default="turbo", type=valid_model_name, help="name of the Whisper model to use")
|
||||
parser.add_argument("--model_dir", type=str, default=None, help="the path to save model files; uses ~/.cache/whisper by default")
|
||||
parser.add_argument("--device", default="cuda" if torch.cuda.is_available() else "cpu", help="device to use for PyTorch inference")
|
||||
parser.add_argument("--device", default=default_device, help="device to use for PyTorch inference")
|
||||
parser.add_argument("--output_dir", "-o", type=str, default=".", help="directory to save the outputs")
|
||||
parser.add_argument("--output_format", "-f", type=str, default="all", choices=["txt", "vtt", "srt", "tsv", "json", "all"], help="format of the output file; if not specified, all available formats will be produced")
|
||||
parser.add_argument("--verbose", type=str2bool, default=True, help="whether to print out the progress and debug messages")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user