You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

StandardSelection.cs 546 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using LLama.Native;
  3. namespace LLama.Sampling.Selection;
  4. /// <summary>
  5. /// Select from all possible tokens according to their probability
  6. /// </summary>
  7. public sealed class StandardSelection
  8. : ITokenSelector
  9. {
  10. /// <inheritdoc />
  11. public int Select(SafeLLamaContextHandle ctx, LLamaTokenDataArray candidates, ReadOnlySpan<int> lastTokens)
  12. {
  13. return candidates.SampleToken(ctx);
  14. }
  15. /// <inheritdoc />
  16. public void Reset()
  17. {
  18. }
  19. /// <inheritdoc />
  20. public void Dispose()
  21. {
  22. }
  23. }