From e173aa85eed867ab7f17875d00121abb58eb574f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stardust=C2=B7=E5=87=8F?= Date: Sat, 23 Dec 2023 11:29:54 +0800 Subject: [PATCH] rollback --- text/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/text/__init__.py b/text/__init__.py index cd31324..98276d2 100644 --- a/text/__init__.py +++ b/text/__init__.py @@ -30,6 +30,25 @@ def get_bert(norm_text, word2ph, language, device, style_text=None, style_weight return bert +def check_bert_models(): + import json + from pathlib import Path + + from config import config + from .bert_utils import _check_bert + + if config.mirror.lower() == "openi": + import openi + + kwargs = {"token": config.openi_token} if config.openi_token else {} + openi.login(**kwargs) + + with open("./bert/bert_models.json", "r") as fp: + models = json.load(fp) + for k, v in models.items(): + local_path = Path("./bert").joinpath(k) + _check_bert(v["repo_id"], v["files"], local_path) + def init_openjtalk(): import platform @@ -41,3 +60,4 @@ def init_openjtalk(): init_openjtalk() +check_bert_models()