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.

llama.llamamodelv1.md 12 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. # LLamaModelV1
  2. Namespace: LLama
  3. #### Caution
  4. This type is obsolete.
  5. ---
  6. ```csharp
  7. public class LLamaModelV1
  8. ```
  9. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [LLamaModelV1](./llama.llamamodelv1.md)
  10. ## Constructors
  11. ### **LLamaModelV1(String, Int32, Int32, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Int32, Int32, Int32, String, String, Boolean)**
  12. ```csharp
  13. public LLamaModelV1(string model_path, int n_ctx, int n_parts, int seed, bool f16_kv, bool logits_all, bool vocab_only, bool use_mmap, bool use_mlock, bool embedding, int n_threads, int n_batch, int last_n_tokens_size, string lora_base, string lora_path, bool verbose)
  14. ```
  15. #### Parameters
  16. `model_path` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  17. `n_ctx` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  18. `n_parts` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  19. `seed` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  20. `f16_kv` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  21. `logits_all` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  22. `vocab_only` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  23. `use_mmap` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  24. `use_mlock` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  25. `embedding` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  26. `n_threads` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  27. `n_batch` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  28. `last_n_tokens_size` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  29. `lora_base` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  30. `lora_path` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  31. `verbose` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  32. ### **LLamaModelV1(LLamaModelV1)**
  33. ```csharp
  34. public LLamaModelV1(LLamaModelV1 other)
  35. ```
  36. #### Parameters
  37. `other` [LLamaModelV1](./llama.llamamodelv1.md)<br>
  38. ## Methods
  39. ### **Tokenize(String)**
  40. ```csharp
  41. public List<int> Tokenize(string text)
  42. ```
  43. #### Parameters
  44. `text` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  45. #### Returns
  46. [List&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)<br>
  47. ### **DeTokenize(IEnumerable&lt;Int32&gt;)**
  48. ```csharp
  49. public string DeTokenize(IEnumerable<int> tokens)
  50. ```
  51. #### Parameters
  52. `tokens` [IEnumerable&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  53. #### Returns
  54. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  55. ### **DeTokenize(Int32)**
  56. ```csharp
  57. public string DeTokenize(int token)
  58. ```
  59. #### Parameters
  60. `token` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  61. #### Returns
  62. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  63. ### **SetCache(LLamaCache)**
  64. ```csharp
  65. public void SetCache(LLamaCache cache)
  66. ```
  67. #### Parameters
  68. `cache` [LLamaCache](./llama.llamacache.md)<br>
  69. ### **Reset()**
  70. ```csharp
  71. public void Reset()
  72. ```
  73. ### **Eval(List&lt;Int32&gt;)**
  74. ```csharp
  75. public void Eval(List<int> tokens)
  76. ```
  77. #### Parameters
  78. `tokens` [List&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)<br>
  79. ### **Sample(Int32, Single, Single, Single, Single, Single)**
  80. ```csharp
  81. public int Sample(int top_k, float top_p, float temp, float repeat_penalty, float frequency_penalty, float presence_penalty)
  82. ```
  83. #### Parameters
  84. `top_k` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  85. `top_p` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  86. `temp` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  87. `repeat_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  88. `frequency_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  89. `presence_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  90. #### Returns
  91. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  92. ### **Generate(IEnumerable&lt;Int32&gt;, Int32, Single, Single, Single, Single, Single, Boolean)**
  93. ```csharp
  94. public IEnumerable<int> Generate(IEnumerable<int> tokens, int top_k, float top_p, float temp, float repeat_penalty, float frequency_penalty, float presence_penalty, bool reset)
  95. ```
  96. #### Parameters
  97. `tokens` [IEnumerable&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  98. `top_k` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  99. `top_p` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  100. `temp` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  101. `repeat_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  102. `frequency_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  103. `presence_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  104. `reset` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  105. #### Returns
  106. [IEnumerable&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  107. ### **CreateEmbedding(String)**
  108. ```csharp
  109. public Embedding CreateEmbedding(string input)
  110. ```
  111. #### Parameters
  112. `input` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  113. #### Returns
  114. [Embedding](./llama.types.embedding.md)<br>
  115. ### **Embed(String)**
  116. ```csharp
  117. public Single[] Embed(string input)
  118. ```
  119. #### Parameters
  120. `input` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  121. #### Returns
  122. [Single[]](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  123. ### **CreateCompletion(String, String, Int32, Single, Single, Int32, Boolean, String[], Single, Single, Single, Int32)**
  124. ```csharp
  125. public IEnumerable<CompletionChunk> CreateCompletion(string prompt, string suffix, int max_tokens, float temperature, float top_p, int logprobs, bool echo, String[] stop, float frequency_penalty, float presence_penalty, float repeat_penalty, int top_k)
  126. ```
  127. #### Parameters
  128. `prompt` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  129. `suffix` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  130. `max_tokens` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  131. `temperature` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  132. `top_p` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  133. `logprobs` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  134. `echo` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  135. `stop` [String[]](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  136. `frequency_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  137. `presence_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  138. `repeat_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  139. `top_k` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  140. #### Returns
  141. [IEnumerable&lt;CompletionChunk&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  142. ### **Call(String, String, Int32, Single, Single, Int32, Boolean, String[], Single, Single, Single, Int32)**
  143. ```csharp
  144. public IEnumerable<CompletionChunk> Call(string prompt, string suffix, int max_tokens, float temperature, float top_p, int logprobs, bool echo, String[] stop, float frequency_penalty, float presence_penalty, float repeat_penalty, int top_k)
  145. ```
  146. #### Parameters
  147. `prompt` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  148. `suffix` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  149. `max_tokens` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  150. `temperature` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  151. `top_p` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  152. `logprobs` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  153. `echo` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  154. `stop` [String[]](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  155. `frequency_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  156. `presence_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  157. `repeat_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  158. `top_k` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  159. #### Returns
  160. [IEnumerable&lt;CompletionChunk&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  161. ### **CreateChatCompletion(IEnumerable&lt;ChatCompletionMessage&gt;, Single, Single, Int32, String[], Int32, Single, Single, Single)**
  162. ```csharp
  163. public IEnumerable<ChatCompletionChunk> CreateChatCompletion(IEnumerable<ChatCompletionMessage> messages, float temperature, float top_p, int top_k, String[] stop, int max_tokens, float presence_penalty, float frequency_penalty, float repeat_penalty)
  164. ```
  165. #### Parameters
  166. `messages` [IEnumerable&lt;ChatCompletionMessage&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  167. `temperature` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  168. `top_p` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  169. `top_k` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  170. `stop` [String[]](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  171. `max_tokens` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  172. `presence_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  173. `frequency_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  174. `repeat_penalty` [Single](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  175. #### Returns
  176. [IEnumerable&lt;ChatCompletionChunk&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  177. ### **SaveState()**
  178. ```csharp
  179. public LLamaState SaveState()
  180. ```
  181. #### Returns
  182. [LLamaState](./llama.llamastate.md)<br>
  183. ### **LoadState(LLamaState)**
  184. ```csharp
  185. public void LoadState(LLamaState state)
  186. ```
  187. #### Parameters
  188. `state` [LLamaState](./llama.llamastate.md)<br>
  189. ### **LongestTokenPrefix(IEnumerable&lt;Int32&gt;, IEnumerable&lt;Int32&gt;)**
  190. ```csharp
  191. internal static int LongestTokenPrefix(IEnumerable<int> a, IEnumerable<int> b)
  192. ```
  193. #### Parameters
  194. `a` [IEnumerable&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  195. `b` [IEnumerable&lt;Int32&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)<br>
  196. #### Returns
  197. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  198. ### **&lt;CreateChatCompletion&gt;g__GetRole|31_0(ChatCompletionMessage)**
  199. ```csharp
  200. internal static string <CreateChatCompletion>g__GetRole|31_0(ChatCompletionMessage message)
  201. ```
  202. #### Parameters
  203. `message` [ChatCompletionMessage](./llama.types.chatcompletionmessage.md)<br>
  204. #### Returns
  205. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>