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.

IInferenceParams.cs 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Collections.Generic;
  2. using LLama.Common;
  3. namespace LLama.Abstractions
  4. {
  5. /// <summary>
  6. /// The paramters used for inference.
  7. /// </summary>
  8. public interface IInferenceParams
  9. {
  10. /// <summary>
  11. /// number of tokens to keep from initial prompt
  12. /// </summary>
  13. public int TokensKeep { get; set; }
  14. /// <summary>
  15. /// how many new tokens to predict (n_predict), set to -1 to inifinitely generate response
  16. /// until it complete.
  17. /// </summary>
  18. public int MaxTokens { get; set; }
  19. /// <summary>
  20. /// logit bias for specific tokens
  21. /// </summary>
  22. public Dictionary<int, float>? LogitBias { get; set; }
  23. /// <summary>
  24. /// Sequences where the model will stop generating further tokens.
  25. /// </summary>
  26. public IEnumerable<string> AntiPrompts { get; set; }
  27. /// <summary>
  28. /// path to file for saving/loading model eval state
  29. /// </summary>
  30. public string PathSession { get; set; }
  31. /// <summary>
  32. /// string to suffix user inputs with
  33. /// </summary>
  34. public string InputSuffix { get; set; }
  35. /// <summary>
  36. /// string to prefix user inputs with
  37. /// </summary>
  38. public string InputPrefix { get; set; }
  39. /// <summary>
  40. /// 0 or lower to use vocab size
  41. /// </summary>
  42. public int TopK { get; set; }
  43. /// <summary>
  44. /// 1.0 = disabled
  45. /// </summary>
  46. public float TopP { get; set; }
  47. /// <summary>
  48. /// 1.0 = disabled
  49. /// </summary>
  50. public float TfsZ { get; set; }
  51. /// <summary>
  52. /// 1.0 = disabled
  53. /// </summary>
  54. public float TypicalP { get; set; }
  55. /// <summary>
  56. /// 1.0 = disabled
  57. /// </summary>
  58. public float Temperature { get; set; }
  59. /// <summary>
  60. /// 1.0 = disabled
  61. /// </summary>
  62. public float RepeatPenalty { get; set; }
  63. /// <summary>
  64. /// last n tokens to penalize (0 = disable penalty, -1 = context size) (repeat_last_n)
  65. /// </summary>
  66. public int RepeatLastTokensCount { get; set; }
  67. /// <summary>
  68. /// frequency penalty coefficient
  69. /// 0.0 = disabled
  70. /// </summary>
  71. public float FrequencyPenalty { get; set; }
  72. /// <summary>
  73. /// presence penalty coefficient
  74. /// 0.0 = disabled
  75. /// </summary>
  76. public float PresencePenalty { get; set; }
  77. /// <summary>
  78. /// Mirostat uses tokens instead of words.
  79. /// algorithm described in the paper https://arxiv.org/abs/2007.14966.
  80. /// 0 = disabled, 1 = mirostat, 2 = mirostat 2.0
  81. /// </summary>
  82. public MirostatType Mirostat { get; set; }
  83. /// <summary>
  84. /// target entropy
  85. /// </summary>
  86. public float MirostatTau { get; set; }
  87. /// <summary>
  88. /// learning rate
  89. /// </summary>
  90. public float MirostatEta { get; set; }
  91. /// <summary>
  92. /// consider newlines as a repeatable token (penalize_nl)
  93. /// </summary>
  94. public bool PenalizeNL { get; set; }
  95. }
  96. }