Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions LLama/LLamaContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ public LLamaContext(LLamaWeights model, IContextParams @params, ILogger? logger
NativeHandle = SafeLLamaContextHandle.Create(model.NativeHandle, lparams);
}

/// <summary>
/// Set the seed for the RNG
/// </summary>
/// <param name="seed"></param>
public void SetSeed(uint seed)
{
NativeHandle.SetSeed(seed);
}

/// <summary>
/// Tokenize a string.
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions LLama/Native/SafeLLamaContextHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,14 @@ public ulong SetState(IntPtr src)
}
}
#endregion

/// <summary>
/// Set the RNG seed
/// </summary>
/// <param name="seed"></param>
public void SetSeed(uint seed)
{
NativeApi.llama_set_rng_seed(this, seed);
}
}
}