Update chinese_bert.py

This commit is contained in:
Stardust·减
2023-09-05 19:38:45 +08:00
committed by GitHub
parent dcd5ed3c43
commit 3719c5e303

View File

@@ -2,16 +2,6 @@ import torch
import sys
from transformers import AutoTokenizer, AutoModelForMaskedLM
device = torch.device(
"cuda"
if torch.cuda.is_available()
else (
"mps"
if sys.platform == "darwin" and torch.backends.mps.is_available()
else "cpu"
)
)
tokenizer = AutoTokenizer.from_pretrained("./bert/chinese-roberta-wwm-ext-large")
def get_bert_feature(text, word2ph, device):