mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Work on Whisper extra cmd line parameter
This commit is contained in:
parent
ee6d07e14e
commit
b409b65454
@ -3222,4 +3222,9 @@ Keep changes?</KeepChangesMessage>
|
|||||||
<WebVttStyleManager>
|
<WebVttStyleManager>
|
||||||
<Title>WebVTT styles</Title>
|
<Title>WebVTT styles</Title>
|
||||||
</WebVttStyleManager>
|
</WebVttStyleManager>
|
||||||
|
<WhisperAdvanced>
|
||||||
|
<Title>Whisper Advanced - extra command line arguments</Title>
|
||||||
|
<CommandLineArguments>Extra pameters for whisper command line:</CommandLineArguments>
|
||||||
|
<Info>Note: Different Whisper implementations have different command line parameters!</Info>
|
||||||
|
</WhisperAdvanced>
|
||||||
</Language>
|
</Language>
|
@ -438,6 +438,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
public string WhisperStableTsLocation { get; set; }
|
public string WhisperStableTsLocation { get; set; }
|
||||||
public string WhisperCppModelLocation { get; set; }
|
public string WhisperCppModelLocation { get; set; }
|
||||||
public string WhisperExtraSettings { get; set; }
|
public string WhisperExtraSettings { get; set; }
|
||||||
|
public string WhisperExtraSettingsHistory { get; set; }
|
||||||
public bool WhisperAutoAdjustTimings { get; set; }
|
public bool WhisperAutoAdjustTimings { get; set; }
|
||||||
public bool WhisperUseLineMaxChars { get; set; }
|
public bool WhisperUseLineMaxChars { get; set; }
|
||||||
public int AudioToTextLineMaxChars { get; set; }
|
public int AudioToTextLineMaxChars { get; set; }
|
||||||
@ -6419,6 +6420,12 @@ $HorzAlign = Center
|
|||||||
settings.Tools.WhisperExtraSettings = subNode.InnerText;
|
settings.Tools.WhisperExtraSettings = subNode.InnerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subNode = node.SelectSingleNode("WhisperExtraSettingsHistory");
|
||||||
|
if (subNode != null)
|
||||||
|
{
|
||||||
|
settings.Tools.WhisperExtraSettingsHistory = subNode.InnerText;
|
||||||
|
}
|
||||||
|
|
||||||
subNode = node.SelectSingleNode("WhisperLanguageCode");
|
subNode = node.SelectSingleNode("WhisperLanguageCode");
|
||||||
if (subNode != null)
|
if (subNode != null)
|
||||||
{
|
{
|
||||||
@ -10819,6 +10826,7 @@ $HorzAlign = Center
|
|||||||
textWriter.WriteElementString("WhisperStableTsLocation", settings.Tools.WhisperStableTsLocation);
|
textWriter.WriteElementString("WhisperStableTsLocation", settings.Tools.WhisperStableTsLocation);
|
||||||
textWriter.WriteElementString("WhisperCppModelLocation", settings.Tools.WhisperCppModelLocation);
|
textWriter.WriteElementString("WhisperCppModelLocation", settings.Tools.WhisperCppModelLocation);
|
||||||
textWriter.WriteElementString("WhisperExtraSettings", settings.Tools.WhisperExtraSettings);
|
textWriter.WriteElementString("WhisperExtraSettings", settings.Tools.WhisperExtraSettings);
|
||||||
|
textWriter.WriteElementString("WhisperExtraSettingsHistory", settings.Tools.WhisperExtraSettingsHistory);
|
||||||
textWriter.WriteElementString("WhisperLanguageCode", settings.Tools.WhisperLanguageCode);
|
textWriter.WriteElementString("WhisperLanguageCode", settings.Tools.WhisperLanguageCode);
|
||||||
textWriter.WriteElementString("WhisperAutoAdjustTimings", settings.Tools.WhisperAutoAdjustTimings.ToString(CultureInfo.InvariantCulture));
|
textWriter.WriteElementString("WhisperAutoAdjustTimings", settings.Tools.WhisperAutoAdjustTimings.ToString(CultureInfo.InvariantCulture));
|
||||||
textWriter.WriteElementString("WhisperUseLineMaxChars", settings.Tools.WhisperUseLineMaxChars.ToString(CultureInfo.InvariantCulture));
|
textWriter.WriteElementString("WhisperUseLineMaxChars", settings.Tools.WhisperUseLineMaxChars.ToString(CultureInfo.InvariantCulture));
|
||||||
|
31
src/ui/Forms/AudioToText/WhisperAdvanced.Designer.cs
generated
31
src/ui/Forms/AudioToText/WhisperAdvanced.Designer.cs
generated
@ -1,6 +1,6 @@
|
|||||||
namespace Nikse.SubtitleEdit.Forms.AudioToText
|
namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||||
{
|
{
|
||||||
partial class WhisperAdvanced
|
sealed partial class WhisperAdvanced
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WhisperAdvanced));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WhisperAdvanced));
|
||||||
this.labelMeasureFont = new System.Windows.Forms.Label();
|
this.labelWhisperExtraCmdLine = new System.Windows.Forms.Label();
|
||||||
this.comboBoxWhisperExtra = new System.Windows.Forms.ComboBox();
|
this.comboBoxWhisperExtra = new System.Windows.Forms.ComboBox();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
this.buttonOK = new System.Windows.Forms.Button();
|
this.buttonOK = new System.Windows.Forms.Button();
|
||||||
@ -47,14 +47,14 @@
|
|||||||
this.tabPageOpenAI.SuspendLayout();
|
this.tabPageOpenAI.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelMeasureFont
|
// labelWhisperExtraCmdLine
|
||||||
//
|
//
|
||||||
this.labelMeasureFont.AutoSize = true;
|
this.labelWhisperExtraCmdLine.AutoSize = true;
|
||||||
this.labelMeasureFont.Location = new System.Drawing.Point(12, 22);
|
this.labelWhisperExtraCmdLine.Location = new System.Drawing.Point(12, 22);
|
||||||
this.labelMeasureFont.Name = "labelMeasureFont";
|
this.labelWhisperExtraCmdLine.Name = "labelWhisperExtraCmdLine";
|
||||||
this.labelMeasureFont.Size = new System.Drawing.Size(202, 13);
|
this.labelWhisperExtraCmdLine.Size = new System.Drawing.Size(202, 13);
|
||||||
this.labelMeasureFont.TabIndex = 217;
|
this.labelWhisperExtraCmdLine.TabIndex = 217;
|
||||||
this.labelMeasureFont.Text = "Extra pameters for whisper command line:";
|
this.labelWhisperExtraCmdLine.Text = "Extra pameters for whisper command line:";
|
||||||
//
|
//
|
||||||
// comboBoxWhisperExtra
|
// comboBoxWhisperExtra
|
||||||
//
|
//
|
||||||
@ -66,6 +66,7 @@
|
|||||||
this.comboBoxWhisperExtra.Name = "comboBoxWhisperExtra";
|
this.comboBoxWhisperExtra.Name = "comboBoxWhisperExtra";
|
||||||
this.comboBoxWhisperExtra.Size = new System.Drawing.Size(680, 21);
|
this.comboBoxWhisperExtra.Size = new System.Drawing.Size(680, 21);
|
||||||
this.comboBoxWhisperExtra.TabIndex = 214;
|
this.comboBoxWhisperExtra.TabIndex = 214;
|
||||||
|
this.comboBoxWhisperExtra.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxWhisperExtra_KeyDown);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
@ -147,7 +148,7 @@
|
|||||||
this.tabPageConstMe.Location = new System.Drawing.Point(4, 22);
|
this.tabPageConstMe.Location = new System.Drawing.Point(4, 22);
|
||||||
this.tabPageConstMe.Name = "tabPageConstMe";
|
this.tabPageConstMe.Name = "tabPageConstMe";
|
||||||
this.tabPageConstMe.Padding = new System.Windows.Forms.Padding(3);
|
this.tabPageConstMe.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tabPageConstMe.Size = new System.Drawing.Size(636, 290);
|
this.tabPageConstMe.Size = new System.Drawing.Size(672, 332);
|
||||||
this.tabPageConstMe.TabIndex = 1;
|
this.tabPageConstMe.TabIndex = 1;
|
||||||
this.tabPageConstMe.Text = "Const-me";
|
this.tabPageConstMe.Text = "Const-me";
|
||||||
this.tabPageConstMe.UseVisualStyleBackColor = true;
|
this.tabPageConstMe.UseVisualStyleBackColor = true;
|
||||||
@ -161,7 +162,7 @@
|
|||||||
this.textBoxConstMe.Name = "textBoxConstMe";
|
this.textBoxConstMe.Name = "textBoxConstMe";
|
||||||
this.textBoxConstMe.ReadOnly = true;
|
this.textBoxConstMe.ReadOnly = true;
|
||||||
this.textBoxConstMe.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.textBoxConstMe.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.textBoxConstMe.Size = new System.Drawing.Size(630, 284);
|
this.textBoxConstMe.Size = new System.Drawing.Size(666, 326);
|
||||||
this.textBoxConstMe.TabIndex = 1;
|
this.textBoxConstMe.TabIndex = 1;
|
||||||
this.textBoxConstMe.Text = resources.GetString("textBoxConstMe.Text");
|
this.textBoxConstMe.Text = resources.GetString("textBoxConstMe.Text");
|
||||||
this.textBoxConstMe.WordWrap = false;
|
this.textBoxConstMe.WordWrap = false;
|
||||||
@ -172,7 +173,7 @@
|
|||||||
this.tabPageOpenAI.Location = new System.Drawing.Point(4, 22);
|
this.tabPageOpenAI.Location = new System.Drawing.Point(4, 22);
|
||||||
this.tabPageOpenAI.Name = "tabPageOpenAI";
|
this.tabPageOpenAI.Name = "tabPageOpenAI";
|
||||||
this.tabPageOpenAI.Padding = new System.Windows.Forms.Padding(3);
|
this.tabPageOpenAI.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tabPageOpenAI.Size = new System.Drawing.Size(636, 290);
|
this.tabPageOpenAI.Size = new System.Drawing.Size(672, 332);
|
||||||
this.tabPageOpenAI.TabIndex = 2;
|
this.tabPageOpenAI.TabIndex = 2;
|
||||||
this.tabPageOpenAI.Text = "OpenAI";
|
this.tabPageOpenAI.Text = "OpenAI";
|
||||||
this.tabPageOpenAI.UseVisualStyleBackColor = true;
|
this.tabPageOpenAI.UseVisualStyleBackColor = true;
|
||||||
@ -186,7 +187,7 @@
|
|||||||
this.textBoxOpenAI.Name = "textBoxOpenAI";
|
this.textBoxOpenAI.Name = "textBoxOpenAI";
|
||||||
this.textBoxOpenAI.ReadOnly = true;
|
this.textBoxOpenAI.ReadOnly = true;
|
||||||
this.textBoxOpenAI.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.textBoxOpenAI.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.textBoxOpenAI.Size = new System.Drawing.Size(630, 284);
|
this.textBoxOpenAI.Size = new System.Drawing.Size(666, 326);
|
||||||
this.textBoxOpenAI.TabIndex = 2;
|
this.textBoxOpenAI.TabIndex = 2;
|
||||||
this.textBoxOpenAI.Text = resources.GetString("textBoxOpenAI.Text");
|
this.textBoxOpenAI.Text = resources.GetString("textBoxOpenAI.Text");
|
||||||
this.textBoxOpenAI.WordWrap = false;
|
this.textBoxOpenAI.WordWrap = false;
|
||||||
@ -198,7 +199,7 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(707, 507);
|
this.ClientSize = new System.Drawing.Size(707, 507);
|
||||||
this.Controls.Add(this.tabControlCommandLineHelp);
|
this.Controls.Add(this.tabControlCommandLineHelp);
|
||||||
this.Controls.Add(this.labelNote);
|
this.Controls.Add(this.labelNote);
|
||||||
this.Controls.Add(this.labelMeasureFont);
|
this.Controls.Add(this.labelWhisperExtraCmdLine);
|
||||||
this.Controls.Add(this.comboBoxWhisperExtra);
|
this.Controls.Add(this.comboBoxWhisperExtra);
|
||||||
this.Controls.Add(this.buttonCancel);
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.buttonOK);
|
this.Controls.Add(this.buttonOK);
|
||||||
@ -225,7 +226,7 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Label labelMeasureFont;
|
private System.Windows.Forms.Label labelWhisperExtraCmdLine;
|
||||||
private System.Windows.Forms.ComboBox comboBoxWhisperExtra;
|
private System.Windows.Forms.ComboBox comboBoxWhisperExtra;
|
||||||
private System.Windows.Forms.Button buttonCancel;
|
private System.Windows.Forms.Button buttonCancel;
|
||||||
private System.Windows.Forms.Button buttonOK;
|
private System.Windows.Forms.Button buttonOK;
|
||||||
|
@ -7,7 +7,7 @@ using Nikse.SubtitleEdit.Core.AudioToText;
|
|||||||
|
|
||||||
namespace Nikse.SubtitleEdit.Forms.AudioToText
|
namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||||
{
|
{
|
||||||
public partial class WhisperAdvanced : Form
|
public sealed partial class WhisperAdvanced : Form
|
||||||
{
|
{
|
||||||
public WhisperAdvanced(string whisperEngine)
|
public WhisperAdvanced(string whisperEngine)
|
||||||
{
|
{
|
||||||
@ -16,14 +16,20 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
|||||||
UiUtil.FixFonts(this);
|
UiUtil.FixFonts(this);
|
||||||
|
|
||||||
comboBoxWhisperExtra.Items.Clear();
|
comboBoxWhisperExtra.Items.Clear();
|
||||||
comboBoxWhisperExtra.Items.Add("--temperature <TEMPERATURE>");
|
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.WhisperExtraSettingsHistory))
|
||||||
comboBoxWhisperExtra.Items.Add("--best_of <BEST_OF>");
|
{
|
||||||
comboBoxWhisperExtra.Items.Add("--beam_size <BEAM_SIZE>");
|
foreach (var line in Configuration.Settings.Tools.WhisperExtraSettingsHistory.SplitToLines())
|
||||||
comboBoxWhisperExtra.Items.Add("--patience <PATIENCE>");
|
{
|
||||||
comboBoxWhisperExtra.Items.Add("--condition_on_previous_text False");
|
if (!string.IsNullOrEmpty(line))
|
||||||
comboBoxWhisperExtra.Items.Add("--fp16 False");
|
{
|
||||||
comboBoxWhisperExtra.Items.Add("--temperature_increment_on_fallback <TEMPERATURE_INCREMENT_ON_FALLBACK>");
|
comboBoxWhisperExtra.Items.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text = LanguageSettings.Current.WhisperAdvanced.Title;
|
||||||
|
labelWhisperExtraCmdLine.Text = LanguageSettings.Current.WhisperAdvanced.CommandLineArguments;
|
||||||
|
labelNote.Text = LanguageSettings.Current.WhisperAdvanced.Info;
|
||||||
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||||
comboBoxWhisperExtra.Text = Configuration.Settings.Tools.WhisperExtraSettings;
|
comboBoxWhisperExtra.Text = Configuration.Settings.Tools.WhisperExtraSettings;
|
||||||
@ -56,6 +62,13 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
|||||||
|
|
||||||
private void buttonOK_Click(object sender, EventArgs e)
|
private void buttonOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var param = comboBoxWhisperExtra.Text.Trim();
|
||||||
|
if (!string.IsNullOrWhiteSpace(param) && !Configuration.Settings.Tools.WhisperExtraSettings.Contains(param))
|
||||||
|
{
|
||||||
|
Configuration.Settings.Tools.WhisperExtraSettingsHistory = param + Environment.NewLine +
|
||||||
|
Configuration.Settings.Tools.WhisperExtraSettingsHistory;
|
||||||
|
}
|
||||||
|
|
||||||
Configuration.Settings.Tools.WhisperExtraSettings = comboBoxWhisperExtra.Text;
|
Configuration.Settings.Tools.WhisperExtraSettings = comboBoxWhisperExtra.Text;
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
@ -64,5 +77,13 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
|||||||
{
|
{
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void comboBoxWhisperExtra_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == Keys.Enter)
|
||||||
|
{
|
||||||
|
buttonOK_Click(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
public LanguageStructure.WaveformGenerateTimeCodes WaveformGenerateTimeCodes;
|
public LanguageStructure.WaveformGenerateTimeCodes WaveformGenerateTimeCodes;
|
||||||
public LanguageStructure.WebVttNewVoice WebVttNewVoice;
|
public LanguageStructure.WebVttNewVoice WebVttNewVoice;
|
||||||
public LanguageStructure.WebVttStyleManager WebVttStyleManager;
|
public LanguageStructure.WebVttStyleManager WebVttStyleManager;
|
||||||
|
public LanguageStructure.WhisperAdvanced WhisperAdvanced;
|
||||||
|
|
||||||
public Language()
|
public Language()
|
||||||
{
|
{
|
||||||
@ -3623,6 +3624,13 @@ Keep changes?",
|
|||||||
{
|
{
|
||||||
Title = "WebVTT styles",
|
Title = "WebVTT styles",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
WhisperAdvanced = new LanguageStructure.WhisperAdvanced
|
||||||
|
{
|
||||||
|
Title = "Whisper Advanced - extra command line arguments",
|
||||||
|
CommandLineArguments = "Extra pameters for whisper command line:",
|
||||||
|
Info = "Note: Different Whisper implementations have different command line parameters!",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static Language Load(StreamReader sr) // normal but slow .net way
|
//public static Language Load(StreamReader sr) // normal but slow .net way
|
||||||
|
@ -8794,6 +8794,15 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
case "WebVttStyleManager/Title":
|
case "WebVttStyleManager/Title":
|
||||||
language.WebVttStyleManager.Title = reader.Value;
|
language.WebVttStyleManager.Title = reader.Value;
|
||||||
break;
|
break;
|
||||||
|
case "WhisperAdvanced/Title":
|
||||||
|
language.WhisperAdvanced.Title = reader.Value;
|
||||||
|
break;
|
||||||
|
case "WhisperAdvanced/CommandLineArguments":
|
||||||
|
language.WhisperAdvanced.CommandLineArguments = reader.Value;
|
||||||
|
break;
|
||||||
|
case "WhisperAdvanced/Info":
|
||||||
|
language.WhisperAdvanced.Info = reader.Value;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3468,5 +3468,12 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
{
|
{
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class WhisperAdvanced
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string CommandLineArguments { get; set; }
|
||||||
|
public string Info { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user