Improve validation for Whisper English only models - thx Purfview :)

This commit is contained in:
Nikolaj Olsson 2024-04-04 15:13:45 +02:00
parent 6a9c8465bc
commit 7e362d1d95

View File

@ -387,7 +387,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
_languageCode = GetLanguage(comboBoxLanguages.Text);
if (comboBoxModels.Items[comboBoxModels.SelectedIndex] is WhisperModel model &&
_languageCode != "en" && model.Name.EndsWith(".en", StringComparison.InvariantCulture))
_languageCode != "en" && IsModelEnglishOnly(model))
{
var result = MessageBox.Show("English model should only be used with English language." + Environment.NewLine +
"Continue anyway?", Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
@ -514,6 +514,13 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
DialogResult = DialogResult.OK;
}
private static bool IsModelEnglishOnly(WhisperModel model)
{
return model.Name.EndsWith(".en", StringComparison.InvariantCulture) ||
model.Name == "distil-large-v2" ||
model.Name == "distil-large-v3";
}
private void ShowProgressBar()
{
progressBar1.Maximum = 100;