Fix multiprocessing bert_gen error of pyopenjtalk_worker
This commit is contained in:
@@ -16,16 +16,3 @@ def cleaned_text_to_sequence(cleaned_text, tones, language):
|
||||
lang_id = language_id_map[language]
|
||||
lang_ids = [lang_id for i in phones]
|
||||
return phones, tones, lang_ids
|
||||
|
||||
|
||||
def get_bert(text, word2ph, language, device, assist_text=None, assist_text_weight=0.7):
|
||||
if language == "ZH":
|
||||
from .chinese_bert import get_bert_feature
|
||||
elif language == "EN":
|
||||
from .english_bert_mock import get_bert_feature
|
||||
elif language == "JP":
|
||||
from .japanese_bert import get_bert_feature
|
||||
else:
|
||||
raise ValueError(f"Language {language} not supported")
|
||||
|
||||
return get_bert_feature(text, word2ph, device, assist_text, assist_text_weight)
|
||||
|
||||
@@ -4,9 +4,6 @@ import re
|
||||
import unicodedata
|
||||
from pathlib import Path
|
||||
|
||||
from . import pyopenjtalk_worker as pyopenjtalk
|
||||
|
||||
pyopenjtalk.initialize()
|
||||
from num2words import num2words
|
||||
from transformers import AutoTokenizer
|
||||
|
||||
@@ -16,9 +13,10 @@ from text.japanese_mora_list import (
|
||||
mora_kata_to_mora_phonemes,
|
||||
mora_phonemes_to_mora_kata,
|
||||
)
|
||||
|
||||
from text.user_dict import update_dict
|
||||
|
||||
from . import pyopenjtalk_worker as pyopenjtalk
|
||||
|
||||
# 最初にpyopenjtalkの辞書を更新
|
||||
update_dict()
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ def get_bert_feature(
|
||||
style_res = torch.cat(style_res["hidden_states"][-3:-2], -1)[0].cpu()
|
||||
style_res_mean = style_res.mean(0)
|
||||
|
||||
assert len(word2ph) == len(text) + 2, text
|
||||
assert len(word2ph) == len(text) + 2, f"word2ph: {word2ph}, text: {text}"
|
||||
word2phone = word2ph
|
||||
phone_level_feature = []
|
||||
for i in range(len(word2phone)):
|
||||
|
||||
Reference in New Issue
Block a user