Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/models/whisper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ namespace ctranslate2 {
}

const dim_t total_max_length = options.max_length;
const bool without_timestamps = prompts[0][prompt_length - 1] == _no_timestamps_id;

DecodingOptions decoding_options;
decoding_options.start_step = start_step;
Expand All @@ -300,7 +301,10 @@ namespace ctranslate2 {
decoding_options.length_penalty = options.length_penalty;
decoding_options.repetition_penalty = options.repetition_penalty;
decoding_options.no_repeat_ngram_size = options.no_repeat_ngram_size;
decoding_options.max_length = std::min(total_max_length / 2, total_max_length - start_step);
decoding_options.max_length = without_timestamps
? total_max_length - start_step
: std::min(total_max_length / 2,
total_max_length - start_step);
decoding_options.sampling_topk = options.sampling_topk;
decoding_options.sampling_temperature = options.sampling_temperature;
decoding_options.num_hypotheses = options.num_hypotheses;
Expand Down Expand Up @@ -329,7 +333,7 @@ namespace ctranslate2 {
decoding_options.logits_processors.emplace_back(no_speech_probs_processor);
}

if (prompts[0][prompt_length - 1] != _no_timestamps_id) {
if (!without_timestamps) {
const size_t timestamp_begin_id = _no_timestamps_id + 1;
const size_t timestamp_end_id = vocabulary.size() - 1;
const size_t max_initial_timestamp_id = timestamp_begin_id + options.max_initial_timestamp_index;
Expand Down
Loading