From 89c4fa29e5810fac7c75cb5edda1565320a5b8a9 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 24 Apr 2023 18:08:16 -0700 Subject: ~Finish integrating faster-whisper I'm able to use the new code to show text in game. Not yet play-tested. --- GUI/GUI/GUI/Config.cpp | 2 +- GUI/GUI/GUI/Frame.cpp | 4 +++- GUI/GUI/GUI/PythonWrapper.cpp | 18 ++++++++++++++++++ GUI/package.ps1 | 44 +++++++++++++++++++++++++++++++++++++++---- 4 files changed, 62 insertions(+), 6 deletions(-) (limited to 'GUI') diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp index f45aa45..f35f95c 100644 --- a/GUI/GUI/GUI/Config.cpp +++ b/GUI/GUI/GUI/Config.cpp @@ -66,7 +66,7 @@ AppConfig::AppConfig(wxTextCtrl* out) language("english"), model("base.en"), button("left joystick"), - window_duration("15"), + window_duration("120"), enable_local_beep(true), use_cpu(false), diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index c9b7281..1195540 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -250,6 +250,8 @@ namespace { "small", "medium.en", "medium", + "large-v1", + "large-v2", }; const size_t kNumModelChoices = sizeof(kModelChoices) / sizeof(kModelChoices[0]); constexpr int kModelDefault = 2; // base.en @@ -2123,7 +2125,7 @@ void Frame::OnAppStart(wxCommandEvent& event) { const int max_rows = 10; const int max_cols = 240; const int min_window_duration_s = 10; - const int max_window_duration_s = 28; + const int max_window_duration_s = 300; if (rows < 0 || rows > max_rows || cols < 0 || cols > max_cols || window_duration < min_window_duration_s || diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index ae0fa49..3a7cc5d 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -296,6 +296,24 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd, return false; } } + + // Add scripts to PATH + std::filesystem::path dll_bin = (std::filesystem::current_path() / + "Resources/Scripts").lexically_normal(); + if (env.find(dll_bin.string()) == std::string::npos) { + env += ";" + dll_bin.string(); + + // Add updated PATH to current process's environment + if (!SetEnvironmentVariableA("PATH", env.c_str())) { + std::ostringstream err_oss; + err_oss << "Error while executing python command \"" + << cmd_oss.str() + << "\": Failed to add python scripts to PATH: " + << GetWin32ErrMsg() << std::endl; + out_cb("", err_oss.str()); + return false; + } + } } std::string cmd_str = cmd_oss.str(); diff --git a/GUI/package.ps1 b/GUI/package.ps1 index 1b7fa6d..e25473a 100644 --- a/GUI/package.ps1 +++ b/GUI/package.ps1 @@ -1,10 +1,12 @@ param( [switch]$skip_zip = $false, - [string]$release = "Release" + [string]$release = "Release", + [string]$install_pip = $true ) echo "Skip zip: $skip_zip" echo "Release: $release" +echo "Install pip: $install_pip" $PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' @@ -50,7 +52,7 @@ if (-Not (Test-Path $pip_path)) { mv $PIP_FILE $pip_path } -if ($true) { +if ($install_pip) { ./Python/python.exe Python/get-pip.py echo "Installing future" @@ -77,6 +79,39 @@ if (-Not (Test-Path $git_dir)) { Read-Host -Prompt "Press enter once PortableGit is installed at $pwd\PortableGit" } +$nvidia_dir = "nvidia_dll" + +if (-Not (Test-Path $nvidia_dir)) { + echo "Fetching CUDNN dependencies" + + mkdir $nvidia_dir + pushd $nvidia_dir > $null + + $ZLIB_URL = "https://drive.google.com/uc?export=download&id=1NpWU83JVOWG0tJtFK7ObygTbOasGWZpI" + Invoke-WebRequest $ZLIB_URL -OutFile "zlibwapi.dll" + + # NVIDIA locks these files behind a fucking login making it a massive + # pain in the dick for end users to download, so I rehosted them. + # TODO check hashes. + echo "Fetching NVIDIA dll 1/4 (600MB)" + $CUDNN_CNN_INFER_URL = "https://drive.google.com/uc?export=download&confirm=yes&id=1Px7SGEOM8uAJNxxMGBSwo4sEE8H7GzkB" + Invoke-WebRequest $CUDNN_CNN_INFER_URL -OutFile "cudnn_cnn_infer64_8.dll" + + echo "Fetching NVIDIA dll 2/4 (80MB)" + $CUDNN_OPS_INFER_URL = "https://drive.google.com/uc?export=download&confirm=yes&id=1mw6Ds1x-4G_GtSzM-GM8y27E9vpQRi_P" + Invoke-WebRequest $CUDNN_OPS_INFER_URL -OutFile "cudnn_ops_infer64_8.dll" + + echo "Fetching NVIDIA dll 3/4 (80MB)" + $CUBLAS_64_DLL = "https://drive.google.com/uc?export=download&confirm=yes&id=1bflxDt83inYM0N2N0ebD1tw0Jh9la33R" + Invoke-WebRequest $CUBLAS_64_DLL -OutFile "cublas64_11.dll" + + echo "Fetching NVIDIA dll 4/4 (150MB)" + $CUBLAS_LT64_DLL = "https://drive.google.com/uc?export=download&confirm=yes&id=1fQuVgpkbI8tNPTwueEeiLCSDzqSSGldI" + Invoke-WebRequest $CUBLAS_Lt64_DLL -OutFile "cublasLt64_11.dll" + + popd > $null +} + mkdir $install_dir > $null mkdir $install_dir/Resources > $null cp -Recurse ../Animations TaSTT/Resources/Animations @@ -87,6 +122,7 @@ cp -Recurse ../Images TaSTT/Resources/Images cp -Recurse Python TaSTT/Resources/Python cp -Recurse PortableGit TaSTT/Resources/PortableGit cp -Recurse ../Scripts TaSTT/Resources/Scripts +cp $nvidia_dir/*.dll TaSTT/Resources/Scripts/ cp -Recurse ../Shaders TaSTT/Resources/Shaders cp -Recurse ../Sounds TaSTT/Resources/Sounds cp -Recurse ../UnityAssets TaSTT/Resources/UnityAssets @@ -94,9 +130,9 @@ cp -Recurse ../BrowserSource TaSTT/Resources/BrowserSource cp GUI/x64/$release/GUI.exe TaSTT/TaSTT.exe cp ../"TaSTT-Whisper"/x64/Release/Whisper.dll TaSTT/Whisper.dll mkdir TaSTT/Resources/Models -#cp $WHISPER_CHECKPOINT_FILE TaSTT/Resources/Models/ if (-Not $skip_zip) { - Compress-Archive -Path "$install_dir" -DestinationPath "$install_dir.zip" -Force + # Compress-Archive shits the bed if the input is larger than 2GB. + & "C:\Program Files\7-Zip\7z.exe" a -tzip "$install_dir.zip" "$install_dir" -mx=9 } -- cgit v1.2.3