Browse Source

Added a method to set the RNG seed on the context

tags/0.9.1
Martin Evans 1 year ago
parent
commit
2df3e7617e
2 changed files with 18 additions and 0 deletions
  1. +9
    -0
      LLama/LLamaContext.cs
  2. +9
    -0
      LLama/Native/SafeLLamaContextHandle.cs

+ 9
- 0
LLama/LLamaContext.cs View File

@@ -86,6 +86,15 @@ namespace LLama
NativeHandle = SafeLLamaContextHandle.Create(model.NativeHandle, lparams);
}

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

/// <summary>
/// Tokenize a string.
/// </summary>


+ 9
- 0
LLama/Native/SafeLLamaContextHandle.cs View File

@@ -283,5 +283,14 @@ namespace LLama.Native
}
}
#endregion

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

Loading…
Cancel
Save