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.

IModelParams.cs 3.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System.Text;
  2. namespace LLama.Abstractions
  3. {
  4. /// <summary>
  5. /// The parameters for initializing a LLama model.
  6. /// </summary>
  7. public interface IModelParams
  8. {
  9. /// <summary>
  10. /// Model context size (n_ctx)
  11. /// </summary>
  12. int ContextSize { get; set; }
  13. /// <summary>
  14. /// the GPU that is used for scratch and small tensors
  15. /// </summary>
  16. int MainGpu { get; set; }
  17. /// <summary>
  18. /// if true, reduce VRAM usage at the cost of performance
  19. /// </summary>
  20. bool LowVram { get; set; }
  21. /// <summary>
  22. /// Number of layers to run in VRAM / GPU memory (n_gpu_layers)
  23. /// </summary>
  24. int GpuLayerCount { get; set; }
  25. /// <summary>
  26. /// Seed for the random number generator (seed)
  27. /// </summary>
  28. int Seed { get; set; }
  29. /// <summary>
  30. /// Use f16 instead of f32 for memory kv (memory_f16)
  31. /// </summary>
  32. bool UseFp16Memory { get; set; }
  33. /// <summary>
  34. /// Use mmap for faster loads (use_mmap)
  35. /// </summary>
  36. bool UseMemorymap { get; set; }
  37. /// <summary>
  38. /// Use mlock to keep model in memory (use_mlock)
  39. /// </summary>
  40. bool UseMemoryLock { get; set; }
  41. /// <summary>
  42. /// Compute perplexity over the prompt (perplexity)
  43. /// </summary>
  44. bool Perplexity { get; set; }
  45. /// <summary>
  46. /// Model path (model)
  47. /// </summary>
  48. string ModelPath { get; set; }
  49. /// <summary>
  50. /// model alias
  51. /// </summary>
  52. string ModelAlias { get; set; }
  53. /// <summary>
  54. /// lora adapter path (lora_adapter)
  55. /// </summary>
  56. string LoraAdapter { get; set; }
  57. /// <summary>
  58. /// base model path for the lora adapter (lora_base)
  59. /// </summary>
  60. string LoraBase { get; set; }
  61. /// <summary>
  62. /// Number of threads (-1 = autodetect) (n_threads)
  63. /// </summary>
  64. int Threads { get; set; }
  65. /// <summary>
  66. /// batch size for prompt processing (must be >=32 to use BLAS) (n_batch)
  67. /// </summary>
  68. int BatchSize { get; set; }
  69. /// <summary>
  70. /// Whether to convert eos to newline during the inference.
  71. /// </summary>
  72. bool ConvertEosToNewLine { get; set; }
  73. /// <summary>
  74. /// Whether to use embedding mode. (embedding) Note that if this is set to true,
  75. /// The LLamaModel won't produce text response anymore.
  76. /// </summary>
  77. bool EmbeddingMode { get; set; }
  78. /// <summary>
  79. /// how split tensors should be distributed across GPUs
  80. /// </summary>
  81. float[]? TensorSplits { get; set; }
  82. /// <summary>
  83. /// Grouped-Query Attention
  84. /// </summary>
  85. int GroupedQueryAttention { get; set; }
  86. /// <summary>
  87. /// RMS Norm Epsilon
  88. /// </summary>
  89. float RmsNormEpsilon { get; set; }
  90. /// <summary>
  91. /// RoPE base frequency
  92. /// </summary>
  93. float RopeFrequencyBase { get; set; }
  94. /// <summary>
  95. /// RoPE frequency scaling factor
  96. /// </summary>
  97. float RopeFrequencyScale { get; set; }
  98. /// <summary>
  99. /// Use experimental mul_mat_q kernels
  100. /// </summary>
  101. bool MulMatQ { get; set; }
  102. /// <summary>
  103. /// The encoding to use for models
  104. /// </summary>
  105. Encoding Encoding { get; set; }
  106. }
  107. }