Skip to content

Commit

Permalink
get writer before loading model
Browse files Browse the repository at this point in the history
in case the user inputs unsupported output format
  • Loading branch information
mercury233 committed Oct 10, 2024
1 parent de14ad8 commit dc6036e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def valid_model_name(name):
output_format: str = args.pop("output_format")
device: str = args.pop("device")
os.makedirs(output_dir, exist_ok=True)
writer = get_writer(output_format, output_dir)

if model_name.endswith(".en") and args["language"] not in {"en", "English"}:
if args["language"] is not None:
Expand All @@ -576,7 +577,6 @@ def valid_model_name(name):

model = load_model(model_name, device=device, download_root=model_dir)

writer = get_writer(output_format, output_dir)
word_options = [
"highlight_words",
"max_line_count",
Expand Down

0 comments on commit dc6036e

Please sign in to comment.