Provide config setting for RVC model cache size

This commit is contained in:
ekoc committed 2025-03-19 21:23:56 +01:00
1 parent 5a99f8b203
commit 5c017f8752
4 files changed
+8 -3

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ class AlltalkConfigRvcSettings(BaseModel):
f0method: str = "fcpe" f0method: str = "fcpe"
embedder_model: str = "hubert" embedder_model: str = "hubert"
training_data_size: int = 45000 training_data_size: int = 45000
model_cache_size: int = 1
class AlltalkConfigTgwUi(BaseModel): class AlltalkConfigTgwUi(BaseModel):
tgwui_activate_tts: bool = True tgwui_activate_tts: bool = True
+2 -1
View File
@@ -26,7 +26,8 @@
"hop_length": 130, "hop_length": 130,
"f0method": "fcpe", "f0method": "fcpe",
"embedder_model": "hubert", "embedder_model": "hubert",
"training_data_size": 45000 "training_data_size": 45000,
"model_cache_size": 1
}, },
"tgwui": { "tgwui": {
"tgwui_activate_tts": true, "tgwui_activate_tts": true,
+2 -1
View File
@@ -20,7 +20,8 @@
"hop_length": $ENV.ALLTALK_RVC_HOP_LENGTH, "hop_length": $ENV.ALLTALK_RVC_HOP_LENGTH,
"f0method": $ENV.ALLTALK_RVC_F0METHOD, "f0method": $ENV.ALLTALK_RVC_F0METHOD,
"embedder_model": $ENV.ALLTALK_RVC_EMBEDDER_MODEL, "embedder_model": $ENV.ALLTALK_RVC_EMBEDDER_MODEL,
"training_data_size": $ENV.ALLTALK_RVC_TRAINING_DATA_SIZE "training_data_size": $ENV.ALLTALK_RVC_TRAINING_DATA_SIZE,
"model_cache_size": $ENV.ALLTALK_RVC_MODEL_CACHE_SIZE
}, },
"api_def": { "api_def": {
"api_port_number": $ENV.ALLTALK_API_PORT_NUMBER, "api_port_number": $ENV.ALLTALK_API_PORT_NUMBER,
+3 -1
View File
@@ -9,6 +9,8 @@ import soundfile as sf
import librosa import librosa
from functools import lru_cache from functools import lru_cache
from config import AlltalkConfig
now_dir = os.getcwd() now_dir = os.getcwd()
sys.path.append(now_dir) sys.path.append(now_dir)
@@ -171,7 +173,7 @@ def voice_conversion(
return None, None return None, None
@lru_cache(maxsize=3) @lru_cache(maxsize=AlltalkConfig.get_instance().rvc_settings.model_cache_size)
def get_vc(weight_root, sid, file_index=None, training_data_size=10000, debug_rvc=False): def get_vc(weight_root, sid, file_index=None, training_data_size=10000, debug_rvc=False):
net_g = None net_g = None
branding="AllTalk " branding="AllTalk "