Refactor: Use PathConfig and pathlib instead of paths.yml loading

This commit is contained in:
litagin02
2024-05-25 10:25:22 +09:00
parent 2771fbd209
commit 8976a3ed2f
22 changed files with 266 additions and 253 deletions

View File

@@ -5,13 +5,12 @@ import torch
import torch.multiprocessing as mp
from tqdm import tqdm
from config import config
from config import get_config
from style_bert_vits2.constants import Languages
from style_bert_vits2.logging import logger
from style_bert_vits2.models import commons
from style_bert_vits2.models.hyper_parameters import HyperParameters
from style_bert_vits2.nlp import (
bert_models,
cleaned_text_to_sequence,
extract_bert_feature,
)
@@ -20,6 +19,7 @@ from style_bert_vits2.nlp.japanese.user_dict import update_dict
from style_bert_vits2.utils.stdout_wrapper import SAFE_STDOUT
config = get_config()
# このプロセスからはワーカーを起動して辞書を使いたいので、ここで初期化
pyopenjtalk_worker.initialize_worker()
@@ -61,7 +61,7 @@ def process_line(x: tuple[str, bool]):
bert = torch.load(bert_path)
assert bert.shape[-1] == len(phone)
except Exception:
bert = extract_bert_feature(text, word2ph, language_str, device)
bert = extract_bert_feature(text, word2ph, Languages(language_str), device)
assert bert.shape[-1] == len(phone)
torch.save(bert, bert_path)