👍[Update] Model : weightのパスをPATH_LOACLから接続するように変更
This commit is contained in:
10
config.py
10
config.py
@@ -40,8 +40,8 @@ class Config:
|
||||
return self._VERSION
|
||||
|
||||
@property
|
||||
def LOCAL_PATH(self):
|
||||
return self._LOCAL_PATH
|
||||
def PATH_LOCAL(self):
|
||||
return self._PATH_LOCAL
|
||||
|
||||
@property
|
||||
def PATH_CONFIG(self):
|
||||
@@ -530,9 +530,9 @@ class Config:
|
||||
def init_config(self):
|
||||
# Read Only
|
||||
self._VERSION = "2.0.1"
|
||||
self._LOCAL_PATH = os_path.dirname(sys.argv[0])
|
||||
self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json")
|
||||
self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs")
|
||||
self._PATH_LOCAL = os_path.dirname(sys.argv[0])
|
||||
self._PATH_CONFIG = os_path.join(self._PATH_LOCAL, "config.json")
|
||||
self._PATH_LOGS = os_path.join(self._PATH_LOCAL, "logs")
|
||||
os_makedirs(self._PATH_LOGS, exist_ok=True)
|
||||
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
||||
self._BOOTH_URL = "https://misyaguziya.booth.pm/"
|
||||
|
||||
@@ -20,8 +20,8 @@ def callbackFilepathLogs():
|
||||
Popen(['explorer', config.PATH_LOGS.replace('/', '\\')], shell=True)
|
||||
|
||||
def callbackFilepathConfigFile():
|
||||
print("callbackFilepathConfigFile", config.LOCAL_PATH.replace('/', '\\'))
|
||||
Popen(['explorer', config.LOCAL_PATH.replace('/', '\\')], shell=True)
|
||||
print("callbackFilepathConfigFile", config.PATH_LOCAL.replace('/', '\\'))
|
||||
Popen(['explorer', config.PATH_LOCAL.replace('/', '\\')], shell=True)
|
||||
|
||||
# func transcription send message
|
||||
def sendMicMessage(message):
|
||||
|
||||
8
model.py
8
model.py
@@ -70,12 +70,12 @@ class Model:
|
||||
self.speaker_audio_recorder = None
|
||||
self.speaker_energy_recorder = None
|
||||
self.speaker_energy_plot_progressbar = None
|
||||
self.translator = Translator()
|
||||
self.translator = Translator(config.PATH_LOCAL)
|
||||
self.keyword_processor = KeywordProcessor()
|
||||
|
||||
def resetTranslator(self):
|
||||
del self.translator
|
||||
self.translator = Translator()
|
||||
self.translator = Translator(config.PATH_LOCAL)
|
||||
|
||||
def resetKeywordProcessor(self):
|
||||
del self.keyword_processor
|
||||
@@ -271,7 +271,7 @@ class Model:
|
||||
folder_name = '_internal'
|
||||
tmp_directory_name = 'tmp'
|
||||
batch_name = 'update.bat'
|
||||
current_directory = config.LOCAL_PATH
|
||||
current_directory = config.PATH_LOCAL
|
||||
|
||||
try:
|
||||
res = requests_get(config.GITHUB_URL)
|
||||
@@ -296,7 +296,7 @@ class Model:
|
||||
program_name = 'VRCT.exe'
|
||||
folder_name = '_internal'
|
||||
batch_name = 'restart.bat'
|
||||
current_directory = config.LOCAL_PATH
|
||||
current_directory = config.PATH_LOCAL
|
||||
copyfile(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name))
|
||||
command = [os_path.join(current_directory, batch_name), program_name]
|
||||
Popen(command, cwd=current_directory)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from deepl import Translator as deepl_Translator
|
||||
from deepl_translate import translate as deepl_web_Translator
|
||||
from translators import translate_text as other_web_Translator
|
||||
@@ -14,11 +15,10 @@ TRANSLATE_MODELS = {
|
||||
|
||||
# Translator
|
||||
class Translator():
|
||||
def __init__(self):
|
||||
pass
|
||||
def __init__(self, path):
|
||||
self.translator_status = {}
|
||||
|
||||
self.translator = ctranslate2.Translator("D:\\WORKSPACE\\WORK\\VRChatProject\\VRCT\\weight", device="cpu", device_index=0, compute_type="int8", inter_threads=1, intra_threads=4)
|
||||
self.weight_path = os.path.join(path, "weight")
|
||||
self.translator = ctranslate2.Translator(self.weight_path, device="cpu", device_index=0, compute_type="int8", inter_threads=1, intra_threads=4)
|
||||
self.tokenizer = transformers.AutoTokenizer.from_pretrained("facebook/m2m100_418M")
|
||||
|
||||
def authentication(self, translator_name, authkey=None):
|
||||
@@ -83,5 +83,4 @@ class Translator():
|
||||
target = results[0].hypotheses[0][1:]
|
||||
|
||||
result = self.tokenizer.decode(self.tokenizer.convert_tokens_to_ids(target))
|
||||
print(result)
|
||||
return result
|
||||
Reference in New Issue
Block a user