Skip to content

Commit

Permalink
Custom Model Directory + Minor Patches
Browse files Browse the repository at this point in the history
Custom Model Directory
  • Loading branch information
cyberofficial authored Sep 18, 2024
2 parents 4ad7486 + 66f2c4d commit 8727723
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 81 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ This script uses argparse to accept command line arguments. The following option
| `--set_microphone` | Set the default microphone to use. You can set the name or its ID number from the list. |
| `--microphone_enabled` | Enables microphone usage. Add `true` after the flag. |
| `--auto_language_lock` | Automatically lock the language based on the detected language after 5 detections. Enables automatic language locking. Will help reduce latency. Use this flag if you are using non-English and if you do not know the current spoken language. |
| `--model_dir` | Default location is "model" folder. You can use this argument to change location. |
| `--use_finetune` | Use fine-tuned model. This will increase accuracy, but will also increase latency. Additional VRAM/RAM usage is required. |
| `--no_log` | Makes it so only the last thing translated/transcribed is shown rather log style list. |
| `--updatebranch` | Check which branch from the repo to check for updates. Default is **master**, choices are **master** and **dev-testing** and **bleeding-under-work**. To turn off update checks use **disable**. **bleeding-under-work** is basically latest changes and can break at any time. |
Expand Down
3 changes: 3 additions & 0 deletions Synthalingua_Wrapper/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@
<setting name="cb_halspassword" serializeAs="String">
<value>False</value>
</setting>
<setting name="modelDIr" serializeAs="String">
<value />
</setting>
</Synthalingua_Wrapper.My.MySettings>
</userSettings>
</configuration>
83 changes: 72 additions & 11 deletions Synthalingua_Wrapper/MainUI.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Synthalingua_Wrapper/MainUI.resx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ This will hide the info for secuirty.</value>
<metadata name="CaptionsInputFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>609, 17</value>
</metadata>
<metadata name="FolderBrowserDialog2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>756, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>84</value>
</metadata>
Expand Down
16 changes: 16 additions & 0 deletions Synthalingua_Wrapper/MainUI.vb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ Public Class MainUI
ConfigTextBox.Text += "--discord_webhook """ & DiscordWebHook.Text & """" & " "
End If

If modelDIr.Text <> "" Then
ConfigTextBox.Text += "--model_dir """ & modelDIr.Text & """" & " "
End If

ConfigTextBox.Text += vbNewLine & "pause"

End Sub
Expand Down Expand Up @@ -328,6 +332,7 @@ Public Class MainUI
hlspassid.Text = .hlspassid
hlspassword.Text = .hlspassword
cb_halspassword.Checked = .cb_halspassword
modelDIr.Text = .modelDIr
Try
PrimaryFolder = .PrimaryFolder
Catch ex As Exception
Expand Down Expand Up @@ -532,6 +537,9 @@ Public Class MainUI
' RAM Size
.RamSize = RamSize.Text.Replace("gb", "")

' Model Location
.modelDIr = modelDIr.Text

' Force RAM
.ForceRam = ForceRam.Checked

Expand Down Expand Up @@ -705,4 +713,12 @@ Public Class MainUI
Private Sub DownloadBTN_FFMPEG_YTDLP_Click(sender As Object, e As EventArgs)

End Sub

Private Sub modelDirPicker_Click(sender As Object, e As EventArgs) Handles modelDirPicker.Click
Using folderBrowserDialog As New FolderBrowserDialog()
If folderBrowserDialog.ShowDialog() = DialogResult.OK Then
modelDIr.Text = folderBrowserDialog.SelectedPath
End If
End Using
End Sub
End Class
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-08-08T06:50:46.6107116Z||;True|2024-08-08T02:34:00.3980329-04:00||;True|2024-08-08T02:31:56.2576355-04:00||;True|2024-08-08T02:27:59.1611557-04:00||;True|2024-08-08T02:26:48.4386992-04:00||;True|2024-08-08T02:24:08.4320611-04:00||;True|2024-08-08T02:19:01.0250722-04:00||;True|2024-08-08T01:51:56.8183777-04:00||;True|2024-08-08T01:50:23.0868936-04:00||;True|2024-08-08T01:50:10.4543482-04:00||;True|2024-08-08T01:49:59.7945394-04:00||;True|2024-08-08T01:47:41.5885686-04:00||;True|2024-08-08T01:46:26.9076296-04:00||;True|2024-08-08T01:46:06.3593091-04:00||;True|2024-08-08T01:44:52.6974951-04:00||;True|2024-08-08T01:43:33.9183523-04:00||;True|2024-08-08T01:43:11.3344818-04:00||;True|2024-08-08T01:40:22.8767718-04:00||;True|2024-08-08T01:38:27.2167559-04:00||;</History>
<History>True|2024-09-18T07:09:20.6489818Z||;True|2024-08-08T02:50:46.6107116-04:00||;True|2024-08-08T02:34:00.3980329-04:00||;True|2024-08-08T02:31:56.2576355-04:00||;True|2024-08-08T02:27:59.1611557-04:00||;True|2024-08-08T02:26:48.4386992-04:00||;True|2024-08-08T02:24:08.4320611-04:00||;True|2024-08-08T02:19:01.0250722-04:00||;True|2024-08-08T01:51:56.8183777-04:00||;True|2024-08-08T01:50:23.0868936-04:00||;True|2024-08-08T01:50:10.4543482-04:00||;True|2024-08-08T01:49:59.7945394-04:00||;True|2024-08-08T01:47:41.5885686-04:00||;True|2024-08-08T01:46:26.9076296-04:00||;True|2024-08-08T01:46:06.3593091-04:00||;True|2024-08-08T01:44:52.6974951-04:00||;True|2024-08-08T01:43:33.9183523-04:00||;True|2024-08-08T01:43:11.3344818-04:00||;True|2024-08-08T01:40:22.8767718-04:00||;True|2024-08-08T01:38:27.2167559-04:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
14 changes: 13 additions & 1 deletion Synthalingua_Wrapper/My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Synthalingua_Wrapper/My Project/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,8 @@
<Setting Name="cb_halspassword" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="modelDIr" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
4 changes: 2 additions & 2 deletions Synthalingua_Wrapper/Synthalingua_Wrapper.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<PackageIcon>syntha.png</PackageIcon>
<ApplicationIcon>assets\syntha.ico</ApplicationIcon>
<AssemblyName>SynthalinguaGUI</AssemblyName>
<Copyright>Build Date: Aug 8 2024 2:50 AM EDT</Copyright>
<Copyright>Build Date: Sep 18 2024 3:02 AM EDT</Copyright>
<FileVersion>3</FileVersion>
<AssemblyVersion>1.1.4.42</AssemblyVersion>
<AssemblyVersion>1.1.4.43</AssemblyVersion>
<Version>1</Version>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion modules/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
print("Loading Extensions")
try:
from modules.version_checker import check_for_updates
from modules.model_downloader import fine_tune_model_dl, fine_tune_model_dl_compressed
#from modules.model_downloader import fine_tune_model_dl, fine_tune_model_dl_compressed
from modules.discord import send_to_discord_webhook
from modules.console_settings import set_window_title
from modules.warnings import print_warning
Expand Down
1 change: 1 addition & 0 deletions modules/parser_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def parse_arguments():
parser.add_argument("--set_microphone", default=None, help="Set default microphone to use.", type=str)
parser.add_argument("--microphone_enabled", default=None, help="Enable microphone by name.", type=str)
parser.add_argument("--auto_language_lock", action='store_true', help="Automatically locks the language based on the detected language after set ammount of transcriptions.")
parser.add_argument("--model_dir", default="models", help="Location where to store downloaded models.")
parser.add_argument("--retry", action='store_true', help="Retries the transcription if it fails. May increase output time.")
parser.add_argument("--use_finetune", action='store_true', help="Use finetuned model.")
parser.add_argument("--updatebranch", default="master", help="Check which branch from the repo to check for updates. Default is master, choices are master and dev-testing and bleeding-under-work. To turn off update checks use disable. bleeding-under-work is basically latest changes and can break at any time.", choices=["master", "dev-testing", "disable", "bleeding-under-work"])
Expand Down
19 changes: 18 additions & 1 deletion modules/version_checker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from modules.imports import *

version = "1.0.99997"
version = "1.0.99998"
ScriptCreator = "cyberofficial"
GitHubRepo = "https://github.com/cyberofficial/Synthalingua"
repo_owner = "cyberofficial"
Expand All @@ -27,12 +27,29 @@ def get_remote_version(repo_owner, repo_name, updatebranch, file_path):
else:
print(f"{Fore.RED}Error: Version not found in the remote file.{Style.RESET_ALL}")
return None
if response.status_code == 404:
print(f"{Fore.RED}Error: The file was not found on the remote repository.{Style.RESET_ALL}")
return None
if response.status_code == 503:
print(f"{Fore.RED}Error: The server is temporarily unavailable.{Style.RESET_ALL}")
return None
if response.status_code == 502:
print(f"{Fore.RED}Error: Bad gateway.{Style.RESET_ALL}")
return None
if response.status_code == 504:
print(f"{Fore.RED}Error: Gateway timeout.{Style.RESET_ALL}")
return None
if response.status_code == 500:
print(f"{Fore.RED}Error: Internal server error.{Style.RESET_ALL}")
return None
else:
print(f"{Fore.RED}An error occurred when checking for updates. Status code: {response.status_code}{Style.RESET_ALL}")
print(f"Could not fetch remote version from: {Fore.YELLOW}{url}{Style.RESET_ALL}")
print(f"Please check your internet connection and try again.")
print("\n\n")
# return with None to indicate an error
return None


def check_for_updates(updatebranch):
local_version = version
Expand Down
Loading

0 comments on commit 8727723

Please sign in to comment.