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 2.0 kB

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