Fix bert path retrieval issue when initializing G2PWPinyin

This commit is contained in:
Spr_Aachen 2025-04-06 22:27:03 +08:00
parent 28effc2d44
commit d8adfe5c90

1
api.py
View File

@ -1007,6 +1007,7 @@ else:
logger.info(f"数据类型: int16")
# 初始化模型
os.environ["bert_path"] = bert_path
cnhubert.cnhubert_base_path = cnhubert_base_path
tokenizer = AutoTokenizer.from_pretrained(bert_path)
bert_model = AutoModelForMaskedLM.from_pretrained(bert_path)