This commit is contained in:
samiabat 2025-03-24 22:30:36 +03:00
parent ee8e5f8ab8
commit 28f9e4d14c

4
api.py
View File

@ -998,9 +998,9 @@ else:
# 初始化模型
cnhubert.cnhubert_base_path = cnhubert_base_path
# tokenizer = AutoTokenizer.from_pretrained(bert_path)
tokenizer = AutoTokenizer.from_pretrained(bert_path)
tokenizer = AutoTokenizer.from_pretrained(bert_path, weights_only=False)
bert_model = AutoModelForMaskedLM.from_pretrained(bert_path)
bert_model = AutoModelForMaskedLM.from_pretrained(bert_path, weights_only=False)
ssl_model = cnhubert.get_model()
if is_half:
bert_model = bert_model.half().to(device)