Add: Type Hint to null_model_params
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
import json
|
||||
from typing import Any, Optional, Union
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
import gradio as gr
|
||||
|
||||
@@ -22,7 +23,7 @@ from style_bert_vits2.nlp import InvalidToneError
|
||||
from style_bert_vits2.nlp.japanese import pyopenjtalk_worker as pyopenjtalk
|
||||
from style_bert_vits2.nlp.japanese.g2p_utils import g2kata_tone, kata_tone2phone_tone
|
||||
from style_bert_vits2.nlp.japanese.normalizer import normalize_text
|
||||
from style_bert_vits2.tts_model import TTSModelHolder
|
||||
from style_bert_vits2.tts_model import NullModelParam, TTSModelHolder
|
||||
from style_bert_vits2.utils import torch_device_to_onnx_providers
|
||||
|
||||
|
||||
@@ -218,16 +219,16 @@ def change_null_model_row(
|
||||
null_voice_pitch_weights: float,
|
||||
null_speech_style_weights: float,
|
||||
null_tempo_weights: float,
|
||||
null_models: dict[int, dict[str, Any]],
|
||||
null_models: dict[int, NullModelParam],
|
||||
):
|
||||
null_models[null_model_index] = {
|
||||
"name": null_model_name,
|
||||
"path": null_model_path,
|
||||
"weight": null_voice_weights,
|
||||
"pitch": null_voice_pitch_weights,
|
||||
"style": null_speech_style_weights,
|
||||
"tempo": null_tempo_weights,
|
||||
}
|
||||
null_models[null_model_index] = NullModelParam(
|
||||
name=null_model_name,
|
||||
path=Path(null_model_path),
|
||||
weight=null_voice_weights,
|
||||
pitch=null_voice_pitch_weights,
|
||||
style=null_speech_style_weights,
|
||||
tempo=null_tempo_weights,
|
||||
)
|
||||
if len(null_models) > null_models_frame:
|
||||
keys_to_keep = list(range(null_models_frame))
|
||||
result = {k: null_models[k] for k in keys_to_keep}
|
||||
@@ -259,7 +260,7 @@ def create_inference_app(model_holder: TTSModelHolder) -> gr.Blocks:
|
||||
speaker,
|
||||
pitch_scale,
|
||||
intonation_scale,
|
||||
null_models: dict[int, dict[str, Union[str, float]]],
|
||||
null_models: dict[int, NullModelParam],
|
||||
force_reload_model: bool,
|
||||
):
|
||||
model_holder.get_model(model_name, model_path)
|
||||
|
||||
Reference in New Issue
Block a user