add bert
This commit is contained in:
@@ -1,2 +1,5 @@
|
|||||||
# bert-vits
|
# bert-vits
|
||||||
vits with bert
|
vits with bert
|
||||||
|
|
||||||
|
put [pytorch_model.bin](https://huggingface.co/hfl/chinese-roberta-wwm-ext-large/resolve/main/pytorch_model.bin)
|
||||||
|
to bert/roberta_wwm_ext_large/
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
import torch
|
import torch
|
||||||
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
||||||
import os
|
|
||||||
|
|
||||||
os.environ['ALL_PROXY']='socks5://127.0.0.1:7890'
|
|
||||||
os.environ['HTTPS_PROXY']='http://127.0.0.1:7890'
|
|
||||||
os.environ['HTTP_PROXY']='http://127.0.0.1:7890'
|
|
||||||
|
|
||||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||||
|
|
||||||
tokenizer = AutoTokenizer.from_pretrained("hfl/chinese-roberta-wwm-ext-large")
|
tokenizer = AutoTokenizer.from_pretrained("./bert/chinese-roberta-wwm-ext-large")
|
||||||
model = AutoModelForMaskedLM.from_pretrained("hfl/chinese-roberta-wwm-ext-large").to(device)
|
model = AutoModelForMaskedLM.from_pretrained("./bert/chinese-roberta-wwm-ext-large").to(device)
|
||||||
|
|
||||||
def get_bert_feature(text, word2ph):
|
def get_bert_feature(text, word2ph):
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
|
|||||||
Reference in New Issue
Block a user