Update Purfview's Faster Whisper to r160.3

This commit is contained in:
niksedk 2023-11-09 20:02:45 +01:00
parent 9bbff6839c
commit 1dae9f6fcb
4 changed files with 33 additions and 5 deletions

View File

@ -17,7 +17,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
return $"{(AlreadyDownloaded ? "* " : string.Empty)}{Name} ({Size})"; return $"{(AlreadyDownloaded ? "* " : string.Empty)}{Name} ({Size})";
} }
private readonly string[] _fileNames = { "model.bin", "config.json", "vocabulary.txt", "tokenizer.json" }; private readonly string[] _fileNames = { "model.bin", "config.json", "vocabulary.txt", "vocabulary.json", "tokenizer.json" };
public string ModelFolder => Path.Combine(Configuration.DataDirectory, "Whisper", "Purfview-Whisper-Faster", "_models"); public string ModelFolder => Path.Combine(Configuration.DataDirectory, "Whisper", "Purfview-Whisper-Faster", "_models");
@ -109,6 +109,13 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
Urls = MakeUrls("https://huggingface.co/guillaumekln/faster-whisper-large-v2/resolve/main"), Urls = MakeUrls("https://huggingface.co/guillaumekln/faster-whisper-large-v2/resolve/main"),
Folder = "faster-whisper-large-v2", Folder = "faster-whisper-large-v2",
}, },
new WhisperModel
{
Name = "large-v3",
Size = "1.5 GB",
Urls = MakeUrls("https://huggingface.co/Purfview/faster-whisper-large-v3-int8/resolve/main"),
Folder = "faster-whisper-large-v3-int8",
},
}; };
private string[] MakeUrls(string baseUrl) private string[] MakeUrls(string baseUrl)

View File

@ -60,15 +60,16 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
}; };
private const string DownloadUrlPurfviewFasterWhisper = "https://github.com/Purfview/whisper-standalone-win/releases/download/faster-whisper/Whisper-Faster_r160.zip"; private const string DownloadUrlPurfviewFasterWhisper = "https://github.com/Purfview/whisper-standalone-win/releases/download/faster-whisper/Whisper-Faster_r160.3_windows.zip";
private static readonly string[] Sha512HashesPurfviewFasterWhisper = private static readonly string[] Sha512HashesPurfviewFasterWhisper =
{ {
"6a3a0e2e7ae69ec259a0d347bf0970cb276d1ce271a71e8785729fe4a453e71e807e31599223ce2d65f6d8eb8e52d6eee53c3d1d22c373e407155d7717a45ceb", // r160 "f66572f08bd93f684c91e40bf873c9c5207d3558ddbea2edaecd6e673300d0349e26ad41e084b7b8a4b74993fb1fd51acb4b9858f7a7c7e9ef1df4de00d07646", // r160.3
}; };
private static readonly string[] OldSha512HashesPurfviewFasterWhisper = private static readonly string[] OldSha512HashesPurfviewFasterWhisper =
{ {
"6a3a0e2e7ae69ec259a0d347bf0970cb276d1ce271a71e8785729fe4a453e71e807e31599223ce2d65f6d8eb8e52d6eee53c3d1d22c373e407155d7717a45ceb", // r160
"d5d81f3450254f988537bba400b316983fba80142027dbae7ed5abcb06ef6ec367dd2f0699f4096458e783573e02b117d8489b4fa03294dc928b40178d316daa", // r153 "d5d81f3450254f988537bba400b316983fba80142027dbae7ed5abcb06ef6ec367dd2f0699f4096458e783573e02b117d8489b4fa03294dc928b40178d316daa", // r153
"c40229a04f67409bf92b58a5f959a9aed3cb9bf467ae6d7dd313a1dc6bff7ed6a2f583a3fa8913684178bf14df71d49bdb933cf9ef8bb6915e4794fc4a2dff08", // r149.1 "c40229a04f67409bf92b58a5f959a9aed3cb9bf467ae6d7dd313a1dc6bff7ed6a2f583a3fa8913684178bf14df71d49bdb933cf9ef8bb6915e4794fc4a2dff08", // r149.1
"22e07106f50301b9a7b818791b825a89c823df25e25e760efd45a7b3b1ea5a5d2048ed24e669729f8bd09dade9ea3902e6452564dd90b88d85cd046cc9eb6efc", // r146 "22e07106f50301b9a7b818791b825a89c823df25e25e760efd45a7b3b1ea5a5d2048ed24e669729f8bd09dade9ea3902e6452564dd90b88d85cd046cc9eb6efc", // r146
@ -319,7 +320,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
if (whisperChoice == WhisperChoice.PurfviewFasterWhisper) if (whisperChoice == WhisperChoice.PurfviewFasterWhisper)
{ {
return hash == "e9cedccc096063f0e70eee1ed9fe8e14d57526f9ee4258aec4c8f7198a3a91776122e5290ace9a10fc7b2246e6b9f75b48c1a0a1fd01b6149eedba77496fbedb"; return hash == "104b85753ce74a81cdec13a2f8665d6af8c2974a3ebef8833cccad15624f311ae17a0e9b9325e3c25cf34edf024127f824c5f000069d7e52459123c9546e1266";
} }
return hash == "c43fed38d1ae99e6fbbd8c842c2d550b4949081c0c7fba72cd2e2e8435ff05eac4f64e659efb09d597c3c062edf1e5026acc375d2a07290fa3c0fca9ac3bd7a2"; return hash == "c43fed38d1ae99e6fbbd8c842c2d550b4949081c0c7fba72cd2e2e8435ff05eac4f64e659efb09d597c3c062edf1e5026acc375d2a07290fa3c0fca9ac3bd7a2";

View File

@ -204,6 +204,19 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
if (streamLength < 50) if (streamLength < 50)
{ {
var text = FileUtil.ReadAllTextShared(_downloadFileName, Encoding.UTF8); var text = FileUtil.ReadAllTextShared(_downloadFileName, Encoding.UTF8);
if (text == "Entry not found" && _downloadFileName.Contains("vocabulary."))
{
try
{
File.Delete(_downloadFileName);
}
catch
{
// ignore
}
return;
}
if (text.Contains("Invalid username or password.")) if (text.Contains("Invalid username or password."))
{ {
throw new Exception("Unable to download file - Invalid username or password! (Perhaps file has a new location)"); throw new Exception("Unable to download file - Invalid username or password! (Perhaps file has a new location)");

View File

@ -668,7 +668,14 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
i++; i++;
} }
Pause(); Pause();
_libvlc_video_set_spu?.Invoke(_mediaPlayer, -1); // turn of embedded subtitles try
{
_libvlc_video_set_spu?.Invoke(_mediaPlayer, -1); // turn of embedded subtitles
}
catch
{
// ignore
}
OnVideoLoaded?.Invoke(_mediaPlayer, new EventArgs()); OnVideoLoaded?.Invoke(_mediaPlayer, new EventArgs());
} }