feat: Update temperature, top_k, and top_p parameters in CustomVoiceForm and VoiceCloneForm for improved voice synthesis

This commit is contained in:
2026-02-05 10:42:23 +08:00
parent 4f535b20e5
commit fa7e17db0d
2 changed files with 16 additions and 22 deletions

View File

@@ -48,9 +48,9 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
const [advancedOpen, setAdvancedOpen] = useState(false) const [advancedOpen, setAdvancedOpen] = useState(false)
const [tempAdvancedParams, setTempAdvancedParams] = useState({ const [tempAdvancedParams, setTempAdvancedParams] = useState({
max_new_tokens: 2048, max_new_tokens: 2048,
temperature: 0.3, temperature: 0.9,
top_k: 20, top_k: 50,
top_p: 0.7, top_p: 1.0,
repetition_penalty: 1.05 repetition_penalty: 1.05
}) })
@@ -79,9 +79,9 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
speaker: '', speaker: '',
instruct: '', instruct: '',
max_new_tokens: 2048, max_new_tokens: 2048,
temperature: 0.3, temperature: 0.9,
top_k: 20, top_k: 50,
top_p: 0.7, top_p: 1.0,
repetition_penalty: 1.05, repetition_penalty: 1.05,
}, },
}) })
@@ -103,9 +103,9 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
setValue('instruct', params.instruct || '') setValue('instruct', params.instruct || '')
setValue('max_new_tokens', params.max_new_tokens || 2048) setValue('max_new_tokens', params.max_new_tokens || 2048)
setValue('temperature', params.temperature || 0.3) setValue('temperature', params.temperature || 0.9)
setValue('top_k', params.top_k || 20) setValue('top_k', params.top_k || 50)
setValue('top_p', params.top_p || 0.7) setValue('top_p', params.top_p || 1.0)
setValue('repetition_penalty', params.repetition_penalty || 1.05) setValue('repetition_penalty', params.repetition_penalty || 1.05)
} }
})) }))
@@ -168,9 +168,6 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
voice_design_id: selectedItem.designId, voice_design_id: selectedItem.designId,
max_new_tokens: data.max_new_tokens, max_new_tokens: data.max_new_tokens,
temperature: data.temperature, temperature: data.temperature,
top_k: data.top_k,
top_p: data.top_p,
repetition_penalty: data.repetition_penalty,
backend: 'local', backend: 'local',
}) })
} else { } else {
@@ -181,9 +178,6 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
saved_design_id: selectedItem.designId, saved_design_id: selectedItem.designId,
max_new_tokens: data.max_new_tokens, max_new_tokens: data.max_new_tokens,
temperature: data.temperature, temperature: data.temperature,
top_k: data.top_k,
top_p: data.top_p,
repetition_penalty: data.repetition_penalty,
}) })
} }
} else { } else {
@@ -338,9 +332,9 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
if (open) { if (open) {
setTempAdvancedParams({ setTempAdvancedParams({
max_new_tokens: watch('max_new_tokens') || 2048, max_new_tokens: watch('max_new_tokens') || 2048,
temperature: watch('temperature') || 0.3, temperature: watch('temperature') || 0.9,
top_k: watch('top_k') || 20, top_k: watch('top_k') || 50,
top_p: watch('top_p') || 0.7, top_p: watch('top_p') || 1.0,
repetition_penalty: watch('repetition_penalty') || 1.05 repetition_penalty: watch('repetition_penalty') || 1.05
}) })
} }
@@ -390,7 +384,7 @@ const CustomVoiceForm = forwardRef<CustomVoiceFormHandle>((_props, ref) => {
value={tempAdvancedParams.temperature} value={tempAdvancedParams.temperature}
onChange={(e) => setTempAdvancedParams({ onChange={(e) => setTempAdvancedParams({
...tempAdvancedParams, ...tempAdvancedParams,
temperature: parseFloat(e.target.value) || 0.3 temperature: parseFloat(e.target.value) || 0.9
})} })}
/> />
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">

View File

@@ -71,9 +71,9 @@ function VoiceCloneForm() {
use_cache: true, use_cache: true,
x_vector_only_mode: false, x_vector_only_mode: false,
max_new_tokens: 2048, max_new_tokens: 2048,
temperature: 0.3, temperature: 0.9,
top_k: 20, top_k: 50,
top_p: 0.7, top_p: 1.0,
repetition_penalty: 1.05, repetition_penalty: 1.05,
} as Partial<FormData>, } as Partial<FormData>,
}) })