Update japanese_bert.py

This commit is contained in:
Stardust·减
2023-09-05 20:24:23 +08:00
committed by GitHub
parent cb80c6550f
commit eee6e42290

View File

@@ -4,7 +4,7 @@ from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("./bert/bert-base-japanese-v3") tokenizer = AutoTokenizer.from_pretrained("./bert/bert-base-japanese-v3")
def get_bert_feature(text, word2ph): def get_bert_feature(text, word2ph, device=None):
if sys.platform == "darwin" and torch.backends.mps.is_available() and device == "cpu": if sys.platform == "darwin" and torch.backends.mps.is_available() and device == "cpu":
device = "mps" device = "mps"
if not device: if not device: