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

@@ -10,7 +10,7 @@ import pandas as pd
import torch
from tqdm import tqdm
from config import config
from config import get_path_config
from style_bert_vits2.logging import logger
from style_bert_vits2.tts_model import TTSModel
@@ -35,6 +35,8 @@ test_texts = [
"この分野の最新の研究成果を使うと、より自然で表現豊かな音声の生成が可能である。深層学習の応用により、感情やアクセントを含む声質の微妙な変化も再現することが出来る。",
]
path_config = get_path_config()
predictor = torch.hub.load(
"tarepan/SpeechMOS:v1.2.0", "utmos22_strong", trust_repo=True
)
@@ -48,17 +50,16 @@ args = parser.parse_args()
model_name: str = args.model_name
device: str = args.device
model_path = Path(config.assets_root) / model_name
model_path = path_config.assets_root / model_name
# .safetensorsファイルを検索
safetensors_files = model_path.glob("*.safetensors")
def get_model(model_file: Path):
return TTSModel(
model_path=str(model_file),
config_path=str(model_file.parent / "config.json"),
style_vec_path=str(model_file.parent / "style_vectors.npy"),
model_path=model_file,
config_path=model_file.parent / "config.json",
style_vec_path=model_file.parent / "style_vectors.npy",
device=device,
)