This commit is contained in:
samiabat 2025-03-24 21:09:02 +03:00
parent f623a5bb96
commit 550c37528c

6
api.py
View File

@ -997,8 +997,10 @@ else:
# 初始化模型
cnhubert.cnhubert_base_path = cnhubert_base_path
tokenizer = AutoTokenizer.from_pretrained(bert_path)
bert_model = AutoModelForMaskedLM.from_pretrained(bert_path)
# tokenizer = AutoTokenizer.from_pretrained(bert_path)
tokenizer = AutoTokenizer.from_pretrained(os.path.join(os.getcwd(), bert_path))
bert_model = AutoModelForMaskedLM.from_pretrained(os.path.join(os.getcwd(), bert_path))
ssl_model = cnhubert.get_model()
if is_half:
bert_model = bert_model.half().to(device)