Use the initial value of params.seed to determine if user supplied seed
Display some helpful information to the user when loading a session to make it clear when the seed applies or not.
This commit is contained in:
parent
e1ec489ef2
commit
76c73987bf
1 changed files with 7 additions and 1 deletions
|
@ -85,6 +85,9 @@ int main(int argc, char ** argv) {
|
|||
|
||||
fprintf(stderr, "%s: build = %d (%s)\n", __func__, BUILD_NUMBER, BUILD_COMMIT);
|
||||
|
||||
// Save the initial seed parameter before overwriting it so it's possible to determine whether
|
||||
// the user supplied a seed or not. This is useful when loading saved sessions.
|
||||
int32_t initial_seed = params.seed;
|
||||
if (params.seed < 0) {
|
||||
params.seed = time(NULL);
|
||||
}
|
||||
|
@ -153,8 +156,11 @@ int main(int argc, char ** argv) {
|
|||
return 1;
|
||||
}
|
||||
session_tokens.resize(n_token_count_out);
|
||||
if (params.seed != -1) {
|
||||
if (initial_seed != -1) {
|
||||
fprintf(stderr, "%s: seed argument overrides session file RNG state, will now use seed: %d\n", __func__, params.seed);
|
||||
llama_set_rng_seed(ctx, params.seed);
|
||||
} else {
|
||||
fprintf(stderr, "%s: using RNG state from loaded session file rather than seed\n", __func__);
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: loaded a session with prompt size of %d tokens\n", __func__, (int) session_tokens.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue