👍️[Update] Models : change print log to json format log
This commit is contained in:
@@ -109,7 +109,8 @@ class Overlay:
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Could not initialise OpenVR", e)
|
import json
|
||||||
|
print(json.dumps({"status":348, "log": f"error:Could not initialise OpenVR {e}"}), flush=True)
|
||||||
|
|
||||||
def updateImage(self, img):
|
def updateImage(self, img):
|
||||||
if self.initialized is True:
|
if self.initialized is True:
|
||||||
@@ -203,8 +204,8 @@ class Overlay:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Could not check SteamVR running")
|
import json
|
||||||
print(e)
|
print(json.dumps({"status":348, "log": f"error:Could not check SteamVR running {e}"}), flush=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def evaluateOpacityFade(self, lastUpdate, currentTime):
|
def evaluateOpacityFade(self, lastUpdate, currentTime):
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ def downloadFile(url, path, func=None):
|
|||||||
func(total_chunk/file_size)
|
func(total_chunk/file_size)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("error:downloadFile()", e)
|
import json
|
||||||
|
print(json.dumps({"status":348, "log": f"error:downloadFile() {e}"}), flush=True)
|
||||||
|
|
||||||
def checkWhisperWeight(root, weight_type):
|
def checkWhisperWeight(root, weight_type):
|
||||||
path = os_path.join(root, "weights", "whisper", weight_type)
|
path = os_path.join(root, "weights", "whisper", weight_type)
|
||||||
@@ -67,7 +68,6 @@ def downloadWhisperWeight(root, weight_type, callbackFunc):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for filename in _FILENAMES:
|
for filename in _FILENAMES:
|
||||||
print("Downloading", filename, "...")
|
|
||||||
file_path = os_path.join(path, filename)
|
file_path = os_path.join(path, filename)
|
||||||
url = huggingface_hub.hf_hub_url(_MODELS[weight_type], filename)
|
url = huggingface_hub.hf_hub_url(_MODELS[weight_type], filename)
|
||||||
downloadFile(url, file_path, func=callbackFunc)
|
downloadFile(url, file_path, func=callbackFunc)
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ class Translator():
|
|||||||
try:
|
try:
|
||||||
self.ctranslate2_tokenizer = transformers.AutoTokenizer.from_pretrained(tokenizer, cache_dir=tokenizer_path)
|
self.ctranslate2_tokenizer = transformers.AutoTokenizer.from_pretrained(tokenizer, cache_dir=tokenizer_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Error: changeCTranslate2Model()", e)
|
import json
|
||||||
|
print(json.dumps({"status":348, "log": f"error:changeCTranslate2Model() {e}"}), flush=True)
|
||||||
tokenizer_path = os.path.join("./weights", "ctranslate2", directory_name, "tokenizer")
|
tokenizer_path = os.path.join("./weights", "ctranslate2", directory_name, "tokenizer")
|
||||||
self.ctranslate2_tokenizer = transformers.AutoTokenizer.from_pretrained(tokenizer, cache_dir=tokenizer_path)
|
self.ctranslate2_tokenizer = transformers.AutoTokenizer.from_pretrained(tokenizer, cache_dir=tokenizer_path)
|
||||||
self.is_loaded_ctranslate2_model = True
|
self.is_loaded_ctranslate2_model = True
|
||||||
|
|||||||
@@ -83,4 +83,5 @@ def downloadCTranslate2Weight(root, weight_type="Small", func=None):
|
|||||||
with ZipFile(os_path.join(tmp_path, filename)) as zf:
|
with ZipFile(os_path.join(tmp_path, filename)) as zf:
|
||||||
zf.extractall(path)
|
zf.extractall(path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("error:downloadCTranslate2Weight()", e)
|
import json
|
||||||
|
print(json.dumps({"status":348, "log": f"error:downloadCTranslate2Weight() {e}"}), flush=True)
|
||||||
Reference in New Issue
Block a user