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.

parameters.md 4.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. # Inference Parameters
  2. Different from `LLamaModel`, when using an executor, `InferenceParams` is passed to the `Infer` method instead of constructor. This is because executors only define the ways to run the model, therefore in each run, you can change the settings for this time inference.
  3. # InferenceParams
  4. Namespace: LLama.Common
  5. ```csharp
  6. public class InferenceParams
  7. ```
  8. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [InferenceParams]()
  9. ## Properties
  10. ### **TokensKeep**
  11. number of tokens to keep from initial prompt
  12. ```csharp
  13. public int TokensKeep { get; set; }
  14. ```
  15. #### Property Value
  16. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  17. ### **MaxTokens**
  18. how many new tokens to predict (n_predict), set to -1 to infinitely generate response
  19. until it complete.
  20. ```csharp
  21. public int MaxTokens { get; set; }
  22. ```
  23. #### Property Value
  24. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  25. ### **LogitBias**
  26. logit bias for specific tokens
  27. ```csharp
  28. public Dictionary<int, float> LogitBias { get; set; }
  29. ```
  30. #### Property Value
  31. [Dictionary&lt;Int32, Single&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2)<br>
  32. ### **AntiPrompts**
  33. Sequences where the model will stop generating further tokens.
  34. ```csharp
  35. public IEnumerable<string> AntiPrompts { get; set; }
  36. ```
  37. #### Property Value
  38. [IEnumerable&lt;String&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  39. ### **PathSession**
  40. path to file for saving/loading model eval state
  41. ```csharp
  42. public string PathSession { get; set; }
  43. ```
  44. #### Property Value
  45. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  46. ### **InputSuffix**
  47. string to suffix user inputs with
  48. ```csharp
  49. public string InputSuffix { get; set; }
  50. ```
  51. #### Property Value
  52. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  53. ### **InputPrefix**
  54. string to prefix user inputs with
  55. ```csharp
  56. public string InputPrefix { get; set; }
  57. ```
  58. #### Property Value
  59. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  60. ### **TopK**
  61. 0 or lower to use vocab size
  62. ```csharp
  63. public int TopK { get; set; }
  64. ```
  65. #### Property Value
  66. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  67. ### **TopP**
  68. 1.0 = disabled
  69. ```csharp
  70. public float TopP { get; set; }
  71. ```
  72. #### Property Value
  73. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  74. ### **TfsZ**
  75. 1.0 = disabled
  76. ```csharp
  77. public float TfsZ { get; set; }
  78. ```
  79. #### Property Value
  80. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  81. ### **TypicalP**
  82. 1.0 = disabled
  83. ```csharp
  84. public float TypicalP { get; set; }
  85. ```
  86. #### Property Value
  87. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  88. ### **Temperature**
  89. 1.0 = disabled
  90. ```csharp
  91. public float Temperature { get; set; }
  92. ```
  93. #### Property Value
  94. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  95. ### **RepeatPenalty**
  96. 1.0 = disabled
  97. ```csharp
  98. public float RepeatPenalty { get; set; }
  99. ```
  100. #### Property Value
  101. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  102. ### **RepeatLastTokensCount**
  103. last n tokens to penalize (0 = disable penalty, -1 = context size) (repeat_last_n)
  104. ```csharp
  105. public int RepeatLastTokensCount { get; set; }
  106. ```
  107. #### Property Value
  108. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  109. ### **FrequencyPenalty**
  110. frequency penalty coefficient
  111. 0.0 = disabled
  112. ```csharp
  113. public float FrequencyPenalty { get; set; }
  114. ```
  115. #### Property Value
  116. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  117. ### **PresencePenalty**
  118. presence penalty coefficient
  119. 0.0 = disabled
  120. ```csharp
  121. public float PresencePenalty { get; set; }
  122. ```
  123. #### Property Value
  124. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  125. ### **Mirostat**
  126. Mirostat uses tokens instead of words.
  127. algorithm described in the paper https://arxiv.org/abs/2007.14966.
  128. 0 = disabled, 1 = mirostat, 2 = mirostat 2.0
  129. ```csharp
  130. public MiroStateType Mirostat { get; set; }
  131. ```
  132. #### Property Value
  133. [MiroStateType]()<br>
  134. ### **MirostatTau**
  135. target entropy
  136. ```csharp
  137. public float MirostatTau { get; set; }
  138. ```
  139. #### Property Value
  140. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  141. ### **MirostatEta**
  142. learning rate
  143. ```csharp
  144. public float MirostatEta { get; set; }
  145. ```
  146. #### Property Value
  147. [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  148. ### **PenalizeNL**
  149. consider newlines as a repeatable token (penalize_nl)
  150. ```csharp
  151. public bool PenalizeNL { get; set; }
  152. ```
  153. #### Property Value
  154. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>