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.

InferenceOptions.cs 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using LLama.Common;
  2. using LLama.Abstractions;
  3. using LLama.Native;
  4. namespace LLama.Web.Common
  5. {
  6. public class InferenceOptions
  7. : IInferenceParams
  8. {
  9. /// <inheritdoc />
  10. public int TokensKeep { get; set; } = 0;
  11. /// <inheritdoc />
  12. public int MaxTokens { get; set; } = -1;
  13. /// <inheritdoc />
  14. public Dictionary<int, float>? LogitBias { get; set; } = null;
  15. /// <inheritdoc />
  16. public IReadOnlyList<string> AntiPrompts { get; set; } = Array.Empty<string>();
  17. /// <inheritdoc />
  18. public int TopK { get; set; } = 40;
  19. /// <inheritdoc />
  20. public float TopP { get; set; } = 0.95f;
  21. /// <inheritdoc />
  22. public float MinP { get; set; } = 0.05f;
  23. /// <inheritdoc />
  24. public float TfsZ { get; set; } = 1.0f;
  25. /// <inheritdoc />
  26. public float TypicalP { get; set; } = 1.0f;
  27. /// <inheritdoc />
  28. public float Temperature { get; set; } = 0.8f;
  29. /// <inheritdoc />
  30. public float RepeatPenalty { get; set; } = 1.1f;
  31. /// <inheritdoc />
  32. public int RepeatLastTokensCount { get; set; } = 64;
  33. /// <inheritdoc />
  34. public float FrequencyPenalty { get; set; } = .0f;
  35. /// <inheritdoc />
  36. public float PresencePenalty { get; set; } = .0f;
  37. /// <inheritdoc />
  38. public MirostatType Mirostat { get; set; } = MirostatType.Disable;
  39. /// <inheritdoc />
  40. public float MirostatTau { get; set; } = 5.0f;
  41. /// <inheritdoc />
  42. public float MirostatEta { get; set; } = 0.1f;
  43. /// <inheritdoc />
  44. public bool PenalizeNL { get; set; } = true;
  45. /// <summary>
  46. /// A grammar to constrain possible tokens
  47. /// </summary>
  48. public SafeLLamaGrammarHandle Grammar { get; set; } = null;
  49. }
  50. }