diff --git a/SubtitleEdit.sln.DotSettings b/SubtitleEdit.sln.DotSettings index 3b111519d..486100f59 100644 --- a/SubtitleEdit.sln.DotSettings +++ b/SubtitleEdit.sln.DotSettings @@ -22,6 +22,7 @@ True True True + True True True True diff --git a/src/libse/AudioToText/WhisperChoice.cs b/src/libse/AudioToText/WhisperChoice.cs index 744152f46..417a950e3 100644 --- a/src/libse/AudioToText/WhisperChoice.cs +++ b/src/libse/AudioToText/WhisperChoice.cs @@ -9,5 +9,6 @@ public const string CTranslate2 = "CTranslate2"; public const string StableTs = "stable-ts"; public const string PurfviewFasterWhisper = "Purfview's Faster-Whisper"; + public const string PurfviewFasterWhisperCuda = "Purfview's Faster-Whisper CUDA"; } } diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs index 1ef3e10d5..0b0fcdedf 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs @@ -66,6 +66,7 @@ this.labelEngine = new System.Windows.Forms.Label(); this.buttonAdvanced = new System.Windows.Forms.Button(); this.labelAdvanced = new System.Windows.Forms.Label(); + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBoxModels.SuspendLayout(); this.groupBoxInputFiles.SuspendLayout(); this.contextMenuStripWhisperAdvanced.SuspendLayout(); @@ -398,34 +399,35 @@ this.runOnlyPostProcessingToolStripMenuItem, this.toolStripSeparatorRunOnlyPostprocessing, this.setCPPConstmeModelsFolderToolStripMenuItem, - this.removeTemporaryFilesToolStripMenuItem}); + this.removeTemporaryFilesToolStripMenuItem, + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem}); this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced"; - this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(259, 76); + this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(320, 120); this.contextMenuStripWhisperAdvanced.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripWhisperAdvanced_Opening); // // runOnlyPostProcessingToolStripMenuItem // this.runOnlyPostProcessingToolStripMenuItem.Name = "runOnlyPostProcessingToolStripMenuItem"; - this.runOnlyPostProcessingToolStripMenuItem.Size = new System.Drawing.Size(258, 22); + this.runOnlyPostProcessingToolStripMenuItem.Size = new System.Drawing.Size(319, 22); this.runOnlyPostProcessingToolStripMenuItem.Text = "Run only post processing"; this.runOnlyPostProcessingToolStripMenuItem.Click += new System.EventHandler(this.runOnlyPostProcessingToolStripMenuItem_Click); // // toolStripSeparatorRunOnlyPostprocessing // this.toolStripSeparatorRunOnlyPostprocessing.Name = "toolStripSeparatorRunOnlyPostprocessing"; - this.toolStripSeparatorRunOnlyPostprocessing.Size = new System.Drawing.Size(255, 6); + this.toolStripSeparatorRunOnlyPostprocessing.Size = new System.Drawing.Size(316, 6); // // setCPPConstmeModelsFolderToolStripMenuItem // this.setCPPConstmeModelsFolderToolStripMenuItem.Name = "setCPPConstmeModelsFolderToolStripMenuItem"; - this.setCPPConstmeModelsFolderToolStripMenuItem.Size = new System.Drawing.Size(258, 22); + this.setCPPConstmeModelsFolderToolStripMenuItem.Size = new System.Drawing.Size(319, 22); this.setCPPConstmeModelsFolderToolStripMenuItem.Text = "Set CPP/Const-me models folder..."; this.setCPPConstmeModelsFolderToolStripMenuItem.Click += new System.EventHandler(this.setCPPConstMeModelsFolderToolStripMenuItem_Click); // // removeTemporaryFilesToolStripMenuItem // this.removeTemporaryFilesToolStripMenuItem.Name = "removeTemporaryFilesToolStripMenuItem"; - this.removeTemporaryFilesToolStripMenuItem.Size = new System.Drawing.Size(258, 22); + this.removeTemporaryFilesToolStripMenuItem.Size = new System.Drawing.Size(319, 22); this.removeTemporaryFilesToolStripMenuItem.Text = "Remove temporary files"; this.removeTemporaryFilesToolStripMenuItem.Click += new System.EventHandler(this.removeTemporaryFilesToolStripMenuItem_Click); // @@ -494,6 +496,13 @@ this.labelAdvanced.TabIndex = 29; this.labelAdvanced.Text = "Advanced..."; // + // downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem + // + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Name = "downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem"; + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Size = new System.Drawing.Size(319, 22); + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Text = "Download CUDA for Perfview\'s Whisper-Faster"; + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Click += new System.EventHandler(this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem_Click); + // // WhisperAudioToText // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -579,5 +588,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparatorRunOnlyPostprocessing; private System.Windows.Forms.Button buttonAdvanced; private System.Windows.Forms.Label labelAdvanced; + private System.Windows.Forms.ToolStripMenuItem downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem; } } \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 8f07048b4..23b2bd391 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -16,6 +16,7 @@ using System.Text.RegularExpressions; using System.Windows.Forms; using Nikse.SubtitleEdit.Controls; using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace Nikse.SubtitleEdit.Forms.AudioToText { @@ -44,6 +45,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText private VideoInfo _videoInfo; private readonly WavePeakData _wavePeaks; public bool UnknownArgument { get; set; } + public bool RunningOnCuda { get; set; } public bool IncompleteModel { get; set; } public string IncompleteModelName { get; set; } @@ -83,6 +85,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText removeTemporaryFilesToolStripMenuItem.Text = LanguageSettings.Current.AudioToText.RemoveTemporaryFiles; buttonAdvanced.Text = LanguageSettings.Current.General.Advanced; labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; + downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Text = LanguageSettings.Current.AudioToText.DownloadFasterWhisperCuda; columnHeaderFileName.Text = LanguageSettings.Current.JoinSubtitles.FileName; @@ -700,6 +703,11 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText UnknownArgument = true; } + if (outLine.Data.Contains("running on: CUDA", StringComparison.OrdinalIgnoreCase)) + { + RunningOnCuda = true; + } + _outputText.Add(outLine.Data.Trim() + Environment.NewLine); foreach (var line in outLine.Data.SplitToLines()) @@ -1617,6 +1625,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText { setCPPConstmeModelsFolderToolStripMenuItem.Text = LanguageSettings.Current.AudioToText.SetCppConstMeFolder; } + + downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Visible = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.PurfviewFasterWhisper; } private void runOnlyPostProcessingToolStripMenuItem_Click(object sender, EventArgs e) @@ -1666,5 +1676,48 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; } } + + private void downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem_Click(object sender, EventArgs e) + { + DownloadCudaForWhisperFaster(this); + } + + public static void DownloadCudaForWhisperFaster(IWin32Window owner) + { + if (MessageBox.Show(string.Format(LanguageSettings.Current.Settings.DownloadX, "Faster-Whisper CUDA (GPU)"), "Subtitle Edit", MessageBoxButtons.YesNoCancel) != DialogResult.Yes) + { + return; + } + + var alreadyInstalled = IsFasterWhisperCudaInstalled(); + + if (alreadyInstalled) + { + if (MessageBox.Show("CUDA is probably already installed - reinstall?", "Subtitle Edit", MessageBoxButtons.YesNoCancel) != DialogResult.Yes) + { + return; + } + } + + using (var downloadForm = new WhisperDownload(WhisperChoice.PurfviewFasterWhisperCuda)) + { + if (downloadForm.ShowDialog(owner) == DialogResult.OK) + { + } + } + } + + public static bool IsFasterWhisperCudaInstalled() + { + var folder = Path.Combine(Configuration.DataDirectory, "Whisper", "Purfview-Whisper-Faster"); + if (!Directory.Exists(folder)) + { + return false; + } + + var cudaFiles = Directory.GetFiles(folder, "cu*.dll"); + var alreadyInstalled = cudaFiles.Length > 2; + return alreadyInstalled; + } } } diff --git a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs index 07957150b..4cc90c51a 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs @@ -57,6 +57,7 @@ this.comboBoxWhisperEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.labelAdvanced = new System.Windows.Forms.Label(); this.buttonAdvanced = new System.Windows.Forms.Button(); + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBoxModels.SuspendLayout(); this.groupBoxInputFiles.SuspendLayout(); this.contextMenuStripWhisperAdvanced.SuspendLayout(); @@ -157,10 +158,23 @@ // // comboBoxLanguages // + this.comboBoxLanguages.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxLanguages.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxLanguages.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxLanguages.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxLanguages.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxLanguages.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxLanguages.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxLanguages.DropDownHeight = 400; this.comboBoxLanguages.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxLanguages.DropDownWidth = 194; this.comboBoxLanguages.FormattingEnabled = true; this.comboBoxLanguages.Location = new System.Drawing.Point(6, 53); + this.comboBoxLanguages.MaxLength = 32767; this.comboBoxLanguages.Name = "comboBoxLanguages"; + this.comboBoxLanguages.SelectedIndex = -1; + this.comboBoxLanguages.SelectedItem = null; + this.comboBoxLanguages.SelectedText = ""; this.comboBoxLanguages.Size = new System.Drawing.Size(194, 21); this.comboBoxLanguages.TabIndex = 7; this.comboBoxLanguages.SelectedIndexChanged += new System.EventHandler(this.comboBoxLanguages_SelectedIndexChanged); @@ -198,10 +212,23 @@ // // comboBoxModels // + this.comboBoxModels.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxModels.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxModels.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxModels.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxModels.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxModels.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxModels.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxModels.DropDownHeight = 400; this.comboBoxModels.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxModels.DropDownWidth = 240; this.comboBoxModels.FormattingEnabled = true; this.comboBoxModels.Location = new System.Drawing.Point(257, 53); + this.comboBoxModels.MaxLength = 32767; this.comboBoxModels.Name = "comboBoxModels"; + this.comboBoxModels.SelectedIndex = -1; + this.comboBoxModels.SelectedItem = null; + this.comboBoxModels.SelectedText = ""; this.comboBoxModels.Size = new System.Drawing.Size(240, 21); this.comboBoxModels.TabIndex = 0; // @@ -290,22 +317,23 @@ // this.contextMenuStripWhisperAdvanced.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.setCPPConstmeModelsFolderToolStripMenuItem, - this.removeTemporaryFilesToolStripMenuItem}); + this.removeTemporaryFilesToolStripMenuItem, + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem}); this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced"; - this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(259, 48); + this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(320, 92); this.contextMenuStripWhisperAdvanced.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripWhisperAdvanced_Opening); // // setCPPConstmeModelsFolderToolStripMenuItem // this.setCPPConstmeModelsFolderToolStripMenuItem.Name = "setCPPConstmeModelsFolderToolStripMenuItem"; - this.setCPPConstmeModelsFolderToolStripMenuItem.Size = new System.Drawing.Size(258, 22); + this.setCPPConstmeModelsFolderToolStripMenuItem.Size = new System.Drawing.Size(319, 22); this.setCPPConstmeModelsFolderToolStripMenuItem.Text = "Set CPP/Const-me models folder..."; this.setCPPConstmeModelsFolderToolStripMenuItem.Click += new System.EventHandler(this.setCPPConstMeModelsFolderToolStripMenuItem_Click); // // removeTemporaryFilesToolStripMenuItem // this.removeTemporaryFilesToolStripMenuItem.Name = "removeTemporaryFilesToolStripMenuItem"; - this.removeTemporaryFilesToolStripMenuItem.Size = new System.Drawing.Size(258, 22); + this.removeTemporaryFilesToolStripMenuItem.Size = new System.Drawing.Size(319, 22); this.removeTemporaryFilesToolStripMenuItem.Text = "Remove temporary files"; this.removeTemporaryFilesToolStripMenuItem.Click += new System.EventHandler(this.removeTemporaryFilesToolStripMenuItem_Click); // @@ -322,9 +350,23 @@ // comboBoxWhisperEngine // this.comboBoxWhisperEngine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxWhisperEngine.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxWhisperEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxWhisperEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxWhisperEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxWhisperEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxWhisperEngine.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxWhisperEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxWhisperEngine.DropDownHeight = 400; this.comboBoxWhisperEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxWhisperEngine.DropDownWidth = 154; + this.comboBoxWhisperEngine.FormattingEnabled = false; this.comboBoxWhisperEngine.Location = new System.Drawing.Point(543, 6); + this.comboBoxWhisperEngine.MaxLength = 32767; this.comboBoxWhisperEngine.Name = "comboBoxWhisperEngine"; + this.comboBoxWhisperEngine.SelectedIndex = -1; + this.comboBoxWhisperEngine.SelectedItem = null; + this.comboBoxWhisperEngine.SelectedText = ""; this.comboBoxWhisperEngine.Size = new System.Drawing.Size(154, 21); this.comboBoxWhisperEngine.TabIndex = 28; this.comboBoxWhisperEngine.SelectedIndexChanged += new System.EventHandler(this.comboBoxWhisperEngine_SelectedIndexChanged); @@ -350,6 +392,13 @@ this.buttonAdvanced.UseVisualStyleBackColor = true; this.buttonAdvanced.Click += new System.EventHandler(this.buttonAdvanced_Click); // + // downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem + // + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Name = "downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem"; + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Size = new System.Drawing.Size(319, 22); + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Text = "Download CUDA for Perfview\'s Whisper-Faster"; + this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Click += new System.EventHandler(this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem_Click); + // // WhisperAudioToTextSelectedLines // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -422,5 +471,6 @@ private System.Windows.Forms.ToolStripMenuItem setCPPConstmeModelsFolderToolStripMenuItem; private System.Windows.Forms.Label labelAdvanced; private System.Windows.Forms.Button buttonAdvanced; + private System.Windows.Forms.ToolStripMenuItem downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem; } } \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs index e0be99aa8..ba51df322 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs @@ -28,6 +28,12 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText public Subtitle TranscribedSubtitle { get; private set; } + public bool UnknownArgument { get; set; } + public bool RunningOnCuda { get; set; } + public bool IncompleteModel { get; set; } + public string IncompleteModelName { get; set; } + + public WhisperAudioToTextSelectedLines(List audioClips, Form parentForm) { UiUtil.PreInitialize(this); @@ -238,6 +244,25 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText return; } + if (outLine.Data.Contains("not all tensors loaded from model file")) + { + IncompleteModel = true; + } + + if (outLine.Data.Contains("error: unknown argument: ", StringComparison.OrdinalIgnoreCase)) + { + UnknownArgument = true; + } + else if (outLine.Data.Contains("error: unrecognized argument: ", StringComparison.OrdinalIgnoreCase)) + { + UnknownArgument = true; + } + + if (outLine.Data.Contains("running on: CUDA", StringComparison.OrdinalIgnoreCase)) + { + RunningOnCuda = true; + } + _outputText.Add(outLine.Data.Trim() + Environment.NewLine); foreach (var line in outLine.Data.SplitToLines()) @@ -688,5 +713,10 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; } } + + private void downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem_Click(object sender, EventArgs e) + { + WhisperAudioToText.DownloadCudaForWhisperFaster(this); + } } } diff --git a/src/ui/Forms/AudioToText/WhisperDownload.cs b/src/ui/Forms/AudioToText/WhisperDownload.cs index fd2be63f0..9509e01b5 100644 --- a/src/ui/Forms/AudioToText/WhisperDownload.cs +++ b/src/ui/Forms/AudioToText/WhisperDownload.cs @@ -72,6 +72,18 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText "5414c15bb1682efc2f737f3ab5f15c4350a70c30a6101b631297420bbc4cb077ef9b88cb6e5512f4adcdafbda85eb894ff92eae07bd70c66efa0b28a08361033", // Whisper-Faster r141.4 }; + private const string DownloadUrlPurfviewFasterWhisperCuda = "https://github.com/Purfview/whisper-standalone-win/releases/download/libs/cuBLAS.and.cuDNN.zip"; + + private static readonly string[] Sha512HashesPurfviewFasterWhisperCuda = + { + "8d3499298bf4ee227c2587ab7ad80a2a6cbac6b64592a2bb2a887821465d20e19ceec2a7d97a4473a9fb47b477cbbba8c69b8e615a42201a6f5509800056a73b", + }; + + private static readonly string[] OldSha512HashesPurfviewFasterWhisperCuda = + { + "", + }; + public WhisperDownload(string whisperChoice) { @@ -96,6 +108,10 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText { downloadUrl = DownloadUrlPurfviewFasterWhisper; } + else if (_whisperChoice == WhisperChoice.PurfviewFasterWhisperCuda) + { + downloadUrl = DownloadUrlPurfviewFasterWhisperCuda; + } try { @@ -152,6 +168,10 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText { hashes = Sha512HashesPurfviewFasterWhisper; } + else if (_whisperChoice == WhisperChoice.PurfviewFasterWhisperCuda) + { + hashes = Sha512HashesPurfviewFasterWhisperCuda; + } else { hashes = Sha512Hashes; @@ -220,6 +240,27 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText } } } + else if (_whisperChoice == WhisperChoice.PurfviewFasterWhisperCuda) + { + folder = Path.Combine(folder, "Purfview-Whisper-Faster"); + if (!Directory.Exists(folder)) + { + Directory.CreateDirectory(folder); + } + + using (var zip = ZipExtractor.Open(downloadStream)) + { + var dir = zip.ReadCentralDir(); + foreach (var entry in dir) + { + if (entry.FileSize > 0) + { + var path = Path.Combine(folder, Path.GetFileName(entry.FilenameInZip)); + zip.ExtractFile(entry, path); + } + } + } + } else { var skipFileNames = new[] { "command.exe", "stream.exe", "talk.exe", "bench.exe" }; @@ -237,10 +278,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText } } - - - - Cursor = Cursors.Default; labelPleaseWait.Text = string.Empty; DialogResult = DialogResult.OK; diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index c7c6b989a..632330c06 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -35270,6 +35270,13 @@ namespace Nikse.SubtitleEdit.Forms UiUtil.OpenFile(SeLogger.GetWhisperLogFilePath()); } } + else if (form.RunningOnCuda && + Configuration.Settings.Tools.WhisperChoice == WhisperChoice.PurfviewFasterWhisper && + !WhisperAudioToText.IsFasterWhisperCudaInstalled()) + { + MessageBox.Show("Faster Whisper CUDA (GPU) seems to be missing."); + WhisperAudioToText.DownloadCudaForWhisperFaster(this); + } else { var customArgument = Configuration.Settings.Tools.WhisperExtraSettings; diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index 05cb4e30b..570ac5c15 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -366,6 +366,7 @@ namespace Nikse.SubtitleEdit.Logic RemoveTemporaryFiles = "Remove temporary files", SetCppConstMeFolder = "Set CPP/Const-me models folder...", OnlyRunPostProcessing = "Run only post-processing/adjust timings", + DownloadFasterWhisperCuda = "Download CUDA for Perfview's Whisper-Faster", }; AssaAttachments = new LanguageStructure.AssaAttachments diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index 094969bb0..993cd5fbc 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -216,6 +216,7 @@ public string RemoveTemporaryFiles { get; set; } public string SetCppConstMeFolder { get; set; } public string OnlyRunPostProcessing { get; set; } + public string DownloadFasterWhisperCuda { get; set; } } public class AssaAttachments