Spaces:
Running on Zero
Running on Zero
app.py
CHANGED
|
@@ -256,7 +256,6 @@ def infer_voice_clone( part, language,audio_tuple,ref_text,use_xvector_only):
|
|
| 256 |
@spaces.GPU
|
| 257 |
def infer_voice_clone_from_prompt(part, language, prompt_file_path):
|
| 258 |
"""Single segment inference for Voice Clone using pre-extracted prompt."""
|
| 259 |
-
seed_everything(42)
|
| 260 |
logger.info("正在加载音频特征文件...")
|
| 261 |
voice_clone_prompt = torch.load(prompt_file_path, map_location='cuda', weights_only=False)
|
| 262 |
logger.info("音频特征文件加载成功。")
|
|
@@ -268,9 +267,10 @@ def infer_voice_clone_from_prompt(part, language, prompt_file_path):
|
|
| 268 |
voice_clone_prompt=voice_clone_prompt,
|
| 269 |
max_new_tokens=2048,
|
| 270 |
# 核心参数:固定 seed
|
| 271 |
-
seed=
|
| 272 |
-
temperature=0.
|
| 273 |
-
top_p=0.
|
|
|
|
| 274 |
)
|
| 275 |
return wavs[0], sr
|
| 276 |
|
|
|
|
| 256 |
@spaces.GPU
|
| 257 |
def infer_voice_clone_from_prompt(part, language, prompt_file_path):
|
| 258 |
"""Single segment inference for Voice Clone using pre-extracted prompt."""
|
|
|
|
| 259 |
logger.info("正在加载音频特征文件...")
|
| 260 |
voice_clone_prompt = torch.load(prompt_file_path, map_location='cuda', weights_only=False)
|
| 261 |
logger.info("音频特征文件加载成功。")
|
|
|
|
| 267 |
voice_clone_prompt=voice_clone_prompt,
|
| 268 |
max_new_tokens=2048,
|
| 269 |
# 核心参数:固定 seed
|
| 270 |
+
seed=4222,
|
| 271 |
+
temperature=0.45, # 配合低温度,音色会更稳
|
| 272 |
+
top_p=0.9,
|
| 273 |
+
repetition_penalty=1.2 # 惩罚重复,防止停顿或复读机现象
|
| 274 |
)
|
| 275 |
return wavs[0], sr
|
| 276 |
|