mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
fix(cli): use typer.Exit instead of non-existent typer.exit (#2089)
This commit is contained in:
1 parent
623ab14d69
commit
6c96c5c6d0
1 file changed
+7
-7
@@ -176,7 +176,7 @@ def optimize(
|
||||
optimized_pipeline = Pipeline.from_pretrained(pipeline)
|
||||
if optimized_pipeline is None:
|
||||
print(f"Could not load pipeline from {pipeline}.")
|
||||
raise typer.exit(code=1)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
# send pipeline to device
|
||||
torch_device = parse_device(device)
|
||||
@@ -316,7 +316,7 @@ def download(
|
||||
)
|
||||
if pretrained_pipeline is None:
|
||||
print(f"Could not load pretrained pipeline from {pipeline}.")
|
||||
raise typer.exit(code=1)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
|
||||
@app.command("apply")
|
||||
@@ -383,7 +383,7 @@ def apply(
|
||||
)
|
||||
if pretrained_pipeline is None:
|
||||
print(f"Could not load pretrained pipeline from {pipeline}.")
|
||||
raise typer.exit(code=1)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
# send pipeline to device
|
||||
torch_device = parse_device(device)
|
||||
@@ -392,7 +392,7 @@ def apply(
|
||||
if audio.is_dir():
|
||||
if into is None or not into.is_dir():
|
||||
typer.echo("When AUDIO is a directory, INTO must also be a directory.")
|
||||
raise typer.exit(code=1)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
inputs: list[Path] = sorted(path for path in audio.iterdir() if path.is_file())
|
||||
rttms: list[Path | None] = [into / (path.stem + ".rttm") for path in inputs]
|
||||
@@ -401,7 +401,7 @@ def apply(
|
||||
else:
|
||||
if not (into is None or into.is_file()):
|
||||
typer.echo("When AUDIO is a file, INTO must also be a file.")
|
||||
raise typer.exit(code=1)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
inputs = [audio]
|
||||
rttms: list[Path | None] = [into]
|
||||
@@ -522,7 +522,7 @@ def benchmark(
|
||||
)
|
||||
if pretrained_pipeline is None:
|
||||
print(f"Could not load pretrained pipeline from {pipeline}.")
|
||||
raise typer.exit(code=1)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
# send pipeline to device
|
||||
torch_device = parse_device(device)
|
||||
@@ -671,7 +671,7 @@ def benchmark(
|
||||
|
||||
# no need to go further than this point if evaluation is not possible
|
||||
if skip_metric:
|
||||
raise typer.exit()
|
||||
raise typer.Exit()
|
||||
|
||||
# save metric results in both CSV and human-readable formats
|
||||
with open(into / f"{benchmark_name}.csv", "w") as csv:
|
||||
|
||||
Reference in new issue
Block a user