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.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. uint 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. uint 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. /// lora adapter path (lora_adapter)
  51. /// </summary>
  52. string LoraAdapter { get; set; }
  53. float LoraAdapterScale { get; set; }
  54. /// <summary>
  55. /// base model path for the lora adapter (lora_base)
  56. /// </summary>
  57. string LoraBase { get; set; }
  58. /// <summary>
  59. /// Number of threads (-1 = autodetect) (n_threads)
  60. /// </summary>
  61. int Threads { get; set; }
  62. /// <summary>
  63. /// batch size for prompt processing (must be >=32 to use BLAS) (n_batch)
  64. /// </summary>
  65. uint BatchSize { get; set; }
  66. /// <summary>
  67. /// Whether to use embedding mode. (embedding) Note that if this is set to true,
  68. /// The LLamaModel won't produce text response anymore.
  69. /// </summary>
  70. bool EmbeddingMode { get; set; }
  71. /// <summary>
  72. /// how split tensors should be distributed across GPUs
  73. /// </summary>
  74. float[]? TensorSplits { get; set; }
  75. /// <summary>
  76. /// RoPE base frequency
  77. /// </summary>
  78. float RopeFrequencyBase { get; set; }
  79. /// <summary>
  80. /// RoPE frequency scaling factor
  81. /// </summary>
  82. float RopeFrequencyScale { get; set; }
  83. /// <summary>
  84. /// Use experimental mul_mat_q kernels
  85. /// </summary>
  86. bool MulMatQ { get; set; }
  87. /// <summary>
  88. /// The encoding to use for models
  89. /// </summary>
  90. Encoding Encoding { get; set; }
  91. /// <summary>
  92. /// Load vocab only (no weights)
  93. /// </summary>
  94. bool VocabOnly { get; set; }
  95. }
  96. }