Set whisper thread count based on the model

This commit is contained in:
Michael Campagnaro 2023-06-05 14:18:44 -04:00
parent ce1599466e
commit e979d1094c
2 changed files with 9 additions and 2 deletions

View File

@ -45,7 +45,7 @@ output_name_without_ext="$2"
model="$3"
threads=$4
# 4 seems to be the sweet spot.
# 4 seems to be the sweet spot for most models, except medium might be faster with 8.
default_thread_count=4
if [[ $input_wav == "" || $output_name_without_ext == "" || $model == "" ]]; then

View File

@ -46,7 +46,14 @@ extract-16bit-wav-from-video "$input_video" "$wav_name"
if [[ $? == 1 ]]; then exit 1; fi
for model in "$@"; do
transcribe-audio "$wav_name" "$output_name_without_ext" "${model}"
# Tweak thread count based on model size.
thread_count=4
if [[ $model == "medium" ]]; then
thread_count=8
fi
transcribe-audio "$wav_name" "$output_name_without_ext" "${model}" $thread_count
if [[ $? == 1 ]]; then
printf "${RED}${BOLD}Saving the audio file \"$wav_name\" in case you want to reuse it for debugging.\n${NORMAL}"
exit 1