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.

IContextParams.cs 2.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Text;
  2. using LLama.Native;
  3. namespace LLama.Abstractions;
  4. /// <summary>
  5. /// The parameters for initializing a LLama context from a model.
  6. /// </summary>
  7. public interface IContextParams
  8. {
  9. /// <summary>
  10. /// Model context size (n_ctx)
  11. /// </summary>
  12. uint ContextSize { get; set; }
  13. /// <summary>
  14. /// batch size for prompt processing (must be >=32 to use BLAS) (n_batch)
  15. /// </summary>
  16. uint BatchSize { get; set; }
  17. /// <summary>
  18. /// Seed for the random number generator (seed)
  19. /// </summary>
  20. uint Seed { get; set; }
  21. /// <summary>
  22. /// Use f16 instead of f32 for memory kv (memory_f16)
  23. /// </summary>
  24. bool UseFp16Memory { get; set; }
  25. /// <summary>
  26. /// Compute perplexity over the prompt (perplexity)
  27. /// </summary>
  28. bool Perplexity { get; set; }
  29. /// <summary>
  30. /// Whether to use embedding mode. (embedding) Note that if this is set to true,
  31. /// The LLamaModel won't produce text response anymore.
  32. /// </summary>
  33. bool EmbeddingMode { get; set; }
  34. /// <summary>
  35. /// RoPE base frequency (null to fetch from the model)
  36. /// </summary>
  37. float? RopeFrequencyBase { get; set; }
  38. /// <summary>
  39. /// RoPE frequency scaling factor (null to fetch from the model)
  40. /// </summary>
  41. float? RopeFrequencyScale { get; set; }
  42. /// <summary>
  43. /// Use experimental mul_mat_q kernels
  44. /// </summary>
  45. bool MulMatQ { get; set; }
  46. /// <summary>
  47. /// The encoding to use for models
  48. /// </summary>
  49. Encoding Encoding { get; set; }
  50. /// <summary>
  51. /// Number of threads (null = autodetect) (n_threads)
  52. /// </summary>
  53. uint? Threads { get; set; }
  54. /// <summary>
  55. /// Number of threads to use for batch processing (null = autodetect) (n_threads)
  56. /// </summary>
  57. uint? BatchThreads { get; set; }
  58. /// <summary>
  59. /// YaRN extrapolation mix factor
  60. /// </summary>
  61. float? YarnExtrapolationFactor { get; set; }
  62. /// <summary>
  63. /// YaRN magnitude scaling factor
  64. /// </summary>
  65. float? YarnAttentionFactor { get; set; }
  66. /// <summary>
  67. /// YaRN low correction dim
  68. /// </summary>
  69. float? YarnBetaFast { get; set; }
  70. /// <summary>
  71. /// YaRN high correction dim
  72. /// </summary>
  73. float? YarnBetaSlow { get; set; }
  74. /// <summary>
  75. /// YaRN original context length
  76. /// </summary>
  77. uint? YarnOriginalContext { get; set; }
  78. /// <summary>
  79. /// YaRN scaling method to use.
  80. /// </summary>
  81. RopeScalingType? YarnScalingType { get; set; }
  82. }