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.

LLamaTokenData.cs 809 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Runtime.InteropServices;
  2. namespace LLama.Native;
  3. /// <summary>
  4. /// A single token along with probability of this token being selected
  5. /// </summary>
  6. [StructLayout(LayoutKind.Sequential)]
  7. public struct LLamaTokenData
  8. {
  9. /// <summary>
  10. /// token id
  11. /// </summary>
  12. public int id;
  13. /// <summary>
  14. /// log-odds of the token
  15. /// </summary>
  16. public float logit;
  17. /// <summary>
  18. /// probability of the token
  19. /// </summary>
  20. public float p;
  21. /// <summary>
  22. /// Create a new LLamaTokenData
  23. /// </summary>
  24. /// <param name="id"></param>
  25. /// <param name="logit"></param>
  26. /// <param name="p"></param>
  27. public LLamaTokenData(int id, float logit, float p)
  28. {
  29. this.id = id;
  30. this.logit = logit;
  31. this.p = p;
  32. }
  33. }