]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
whisper : initialize decoder's rng with unique seed (#2932)
authorDaniel Bevenius <redacted>
Mon, 24 Mar 2025 08:36:07 +0000 (09:36 +0100)
committerGitHub <redacted>
Mon, 24 Mar 2025 08:36:07 +0000 (09:36 +0100)
This change initializes each decoder's random number generator with a
unique seed.

The motivation for this is that currently all decoders are initialized
with the same seed value, 0. The result of this is that for the same
state (logits, probs, and logprobs) they will produce the same output.

src/whisper.cpp

index 1fcb670e3ac64884809820096ca22662a596d011..547dcf235bb21a5579c84a8a9c0ff14e76b70890 100644 (file)
@@ -5528,7 +5528,7 @@ int whisper_full_with_state(
         decoder.logprobs.resize(ctx->vocab.n_vocab);
         decoder.logits_id.reserve(ctx->model.hparams.n_vocab);
 
-        decoder.rng = std::mt19937(0);
+        decoder.rng = std::mt19937(j);
     }
 
     // the accumulated text context so far