expose seed to api

This commit is contained in:
Xuan Son Nguyen
2026-08-18 11:55:43 +02:00
parent 4daa33ddb0
commit c450cd68e0
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -802,6 +802,8 @@ Returns raw audio bytes (`audio/wav` by default) rather than JSON. For more info
`repeat_penalty`: Repetition penalty applied to the backbone sampler over the whole generation (default `1.05`). Without this, the backbone can loop and re-generate the same utterance.
`seed`: RNG seed for both the backbone sampler and the codec/vocoder (`-1` = random, the default). Set to a fixed value for reproducible output.
`n_predict`: Max number of audio frames to generate. Defaults to `512`; generation normally stops earlier once the model emits an end-of-speech token.
`response_format`: `wav` (default) or `pcm` (raw `float32` samples, no header).
+2
View File
@@ -5241,6 +5241,8 @@ void server_routes::init_routes() {
task.params.sampling = params.sampling; // baseline defaults, then apply overrides below
task.params.sampling.penalty_repeat = json_value(body, "repeat_penalty", 1.05f);
task.params.sampling.penalty_last_n = -1;
task.params.sampling.seed = json_value(body, "seed", params.sampling.seed);
task.tts_inp.data.seed = task.params.sampling.seed; // same seed for the codec/vocoder RNG
if (task.tts_inp.data.top_k > 0) {
task.params.sampling.top_k = task.tts_inp.data.top_k;
}