Skip to content

Commit

Permalink
remove constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Nov 28, 2024
1 parent 8ff7856 commit 28a362b
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/whisper_ctranslate2/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def read_command_line():

caching_args.add_argument(
"--local_files_only",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="use only models in cache without connecting to Internet to check if there are newer versions",
)
Expand Down Expand Up @@ -104,47 +104,47 @@ def read_command_line():
outputs_args.add_argument(
"--pretty_json",
"-p",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="produce json in a human readable format",
)

outputs_args.add_argument(
"--print_colors",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="print the transcribed text using an experimental color coding strategy to highlight words with high or low confidence",
)

outputs_args.add_argument(
"--verbose",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=True,
help="whether to print out the progress and debug messages",
)

outputs_args.add_argument(
"--highlight_words",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="underline each word as it is spoken in srt and vtt output formats (requires --word_timestamps True)",
)

outputs_args.add_argument(
"--max_line_width",
type=CommandLine()._optional_int,
type=CommandLine._optional_int,
default=None,
help="the maximum number of characters in a line before breaking the line in srt and vtt output formats (requires --word_timestamps True)",
)
outputs_args.add_argument(
"--max_line_count",
type=CommandLine()._optional_int,
type=CommandLine._optional_int,
default=None,
help="the maximum number of lines in a segment in srt and vtt output formats (requires --word_timestamps True)",
)
outputs_args.add_argument(
"--max_words_per_line",
type=CommandLine()._optional_int,
type=CommandLine._optional_int,
default=None,
help="(requires --word_timestamps True, no effect with --max_line_width) the maximum number of words in a segment",
)
Expand All @@ -163,7 +163,7 @@ def read_command_line():

computing_args.add_argument(
"--threads",
type=CommandLine()._optional_int,
type=CommandLine._optional_int,
default=0,
help="number of threads used for CPU inference",
)
Expand Down Expand Up @@ -220,7 +220,7 @@ def read_command_line():

algorithm_args.add_argument(
"--temperature_increment_on_fallback",
type=CommandLine()._optional_float,
type=CommandLine._optional_float,
default=0.2,
help="temperature to increase when falling back when the decoding fails to meet either of the thresholds below",
)
Expand All @@ -241,13 +241,13 @@ def read_command_line():

algorithm_args.add_argument(
"--best_of",
type=CommandLine()._optional_int,
type=CommandLine._optional_int,
default=5,
help="number of candidates when sampling with non-zero temperature",
)
algorithm_args.add_argument(
"--beam_size",
type=CommandLine()._optional_int,
type=CommandLine._optional_int,
default=5,
help="number of beams in beam search, only applicable when temperature is zero",
)
Expand All @@ -265,7 +265,7 @@ def read_command_line():
)
algorithm_args.add_argument(
"--suppress_blank",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default="True",
help="suppress blank outputs at the beginning of the sampling",
)
Expand All @@ -283,31 +283,31 @@ def read_command_line():
)
algorithm_args.add_argument(
"--condition_on_previous_text",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=True,
help="if True, provide the previous output of the model as a prompt for the next window; disabling may make the text inconsistent across windows, but the model becomes less prone to getting stuck in a failure loop",
)
algorithm_args.add_argument(
"--compression_ratio_threshold",
type=CommandLine()._optional_float,
type=CommandLine._optional_float,
default=2.4,
help="if the gzip compression ratio is higher than this value, treat the decoding as failed",
)
algorithm_args.add_argument(
"--logprob_threshold",
type=CommandLine()._optional_float,
type=CommandLine._optional_float,
default=-1.0,
help="if the average log probability is lower than this value, treat the decoding as failed",
)
algorithm_args.add_argument(
"--no_speech_threshold",
type=CommandLine()._optional_float,
type=CommandLine._optional_float,
default=0.6,
help="if the probability of the <|nospeech|> token is higher than this value AND the decoding has failed due to `logprob_threshold`, consider the segment as silence",
)
algorithm_args.add_argument(
"--word_timestamps",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="(experimental) extract word-level timestamps and refine the results based on them",
)
Expand Down Expand Up @@ -338,7 +338,7 @@ def read_command_line():
)
algorithm_args.add_argument(
"--hallucination_silence_threshold",
type=CommandLine()._optional_float,
type=CommandLine._optional_float,
default=None,
help="When word_timestamps is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected",
)
Expand All @@ -351,7 +351,7 @@ def read_command_line():

algorithm_args.add_argument(
"--batched",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default="False",
help="Uses Batched transcription which can provide an additional 2x-3x speed increase",
)
Expand All @@ -360,7 +360,7 @@ def read_command_line():

vad_args.add_argument(
"--vad_filter",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="enable the voice activity detection (VAD) to filter out parts of the audio without speech. This step is using the Silero VAD model https://github.com/snakers4/silero-vad.",
)
Expand Down Expand Up @@ -419,7 +419,7 @@ def read_command_line():

live_args.add_argument(
"--live_transcribe",
type=CommandLine()._str2bool,
type=CommandLine._str2bool,
default=False,
help="live transcribe mode",
)
Expand Down

0 comments on commit 28a362b

Please sign in to comment.