Put the transcribe token before the language one. (#553)

This commit is contained in:
Laurent Mazare
2023-08-22 16:46:34 +01:00
committed by GitHub
parent ec665acad7
commit cc22d4db20

View File

@ -142,6 +142,9 @@ impl Decoder {
let mut sum_logprob = 0f64;
let mut no_speech_prob = f64::NAN;
let mut tokens = vec![self.sot_token];
if let Some(language_token) = self.language_token {
tokens.push(language_token);
}
match self.task {
Some(Task::Transcribe) => tokens.push(self.transcribe_token),
Some(Task::Translate) => tokens.push(self.translate_token),
@ -149,9 +152,6 @@ impl Decoder {
// Nothing in this case, same as the Python implementation.
}
}
if let Some(language_token) = self.language_token {
tokens.push(language_token);
}
if !self.timestamps {
tokens.push(self.no_timestamps_token);
}