Browse Source

Merge pull request #368 from martindevans/context_set_seed

Context Set Seed
tags/0.9.1
Martin Evans GitHub 1 year ago
parent
commit
c298ab828a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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); 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> /// <summary>
/// Tokenize a string. /// Tokenize a string.
/// </summary> /// </summary>


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

@@ -283,5 +283,14 @@ namespace LLama.Native
} }
} }
#endregion #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