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.common.modelparams.md 5.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. # ModelParams
  2. Namespace: LLama.Common
  3. ```csharp
  4. public class ModelParams
  5. ```
  6. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ModelParams](./llama.common.modelparams.md)
  7. ## Properties
  8. ### **ContextSize**
  9. Model context size (n_ctx)
  10. ```csharp
  11. public int ContextSize { get; set; }
  12. ```
  13. #### Property Value
  14. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  15. ### **GpuLayerCount**
  16. Number of layers to run in VRAM / GPU memory (n_gpu_layers)
  17. ```csharp
  18. public int GpuLayerCount { get; set; }
  19. ```
  20. #### Property Value
  21. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  22. ### **Seed**
  23. Seed for the random number generator (seed)
  24. ```csharp
  25. public int Seed { get; set; }
  26. ```
  27. #### Property Value
  28. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  29. ### **UseFp16Memory**
  30. Use f16 instead of f32 for memory kv (memory_f16)
  31. ```csharp
  32. public bool UseFp16Memory { get; set; }
  33. ```
  34. #### Property Value
  35. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  36. ### **UseMemorymap**
  37. Use mmap for faster loads (use_mmap)
  38. ```csharp
  39. public bool UseMemorymap { get; set; }
  40. ```
  41. #### Property Value
  42. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  43. ### **UseMemoryLock**
  44. Use mlock to keep model in memory (use_mlock)
  45. ```csharp
  46. public bool UseMemoryLock { get; set; }
  47. ```
  48. #### Property Value
  49. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  50. ### **Perplexity**
  51. Compute perplexity over the prompt (perplexity)
  52. ```csharp
  53. public bool Perplexity { get; set; }
  54. ```
  55. #### Property Value
  56. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  57. ### **ModelPath**
  58. Model path (model)
  59. ```csharp
  60. public string ModelPath { get; set; }
  61. ```
  62. #### Property Value
  63. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  64. ### **LoraAdapter**
  65. lora adapter path (lora_adapter)
  66. ```csharp
  67. public string LoraAdapter { get; set; }
  68. ```
  69. #### Property Value
  70. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  71. ### **LoraBase**
  72. base model path for the lora adapter (lora_base)
  73. ```csharp
  74. public string LoraBase { get; set; }
  75. ```
  76. #### Property Value
  77. [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  78. ### **Threads**
  79. Number of threads (-1 = autodetect) (n_threads)
  80. ```csharp
  81. public int Threads { get; set; }
  82. ```
  83. #### Property Value
  84. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  85. ### **BatchSize**
  86. batch size for prompt processing (must be &gt;=32 to use BLAS) (n_batch)
  87. ```csharp
  88. public int BatchSize { get; set; }
  89. ```
  90. #### Property Value
  91. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  92. ### **ConvertEosToNewLine**
  93. Whether to convert eos to newline during the inference.
  94. ```csharp
  95. public bool ConvertEosToNewLine { get; set; }
  96. ```
  97. #### Property Value
  98. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  99. ### **EmbeddingMode**
  100. Whether to use embedding mode. (embedding) Note that if this is set to true,
  101. The LLamaModel won't produce text response anymore.
  102. ```csharp
  103. public bool EmbeddingMode { get; set; }
  104. ```
  105. #### Property Value
  106. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  107. ## Constructors
  108. ### **ModelParams(String, Int32, Int32, Int32, Boolean, Boolean, Boolean, Boolean, String, String, Int32, Int32, Boolean, Boolean)**
  109. ```csharp
  110. public ModelParams(string modelPath, int contextSize, int gpuLayerCount, int seed, bool useFp16Memory, bool useMemorymap, bool useMemoryLock, bool perplexity, string loraAdapter, string loraBase, int threads, int batchSize, bool convertEosToNewLine, bool embeddingMode)
  111. ```
  112. #### Parameters
  113. `modelPath` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  114. The model path.
  115. `contextSize` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  116. Model context size (n_ctx)
  117. `gpuLayerCount` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  118. Number of layers to run in VRAM / GPU memory (n_gpu_layers)
  119. `seed` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  120. Seed for the random number generator (seed)
  121. `useFp16Memory` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  122. Whether to use f16 instead of f32 for memory kv (memory_f16)
  123. `useMemorymap` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  124. Whether to use mmap for faster loads (use_mmap)
  125. `useMemoryLock` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  126. Whether to use mlock to keep model in memory (use_mlock)
  127. `perplexity` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  128. Thether to compute perplexity over the prompt (perplexity)
  129. `loraAdapter` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  130. Lora adapter path (lora_adapter)
  131. `loraBase` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  132. Base model path for the lora adapter (lora_base)
  133. `threads` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  134. Number of threads (-1 = autodetect) (n_threads)
  135. `batchSize` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  136. Batch size for prompt processing (must be &gt;=32 to use BLAS) (n_batch)
  137. `convertEosToNewLine` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  138. Whether to convert eos to newline during the inference.
  139. `embeddingMode` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  140. Whether to use embedding mode. (embedding) Note that if this is set to true, The LLamaModel won't produce text response anymore.