|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System.Text;
- using LLama.Abstractions;
-
- namespace LLama.Web.Common
- {
- public class ModelOptions
- : ILLamaParams
- {
-
- public string Name { get; set; }
- public int MaxInstances { get; set; }
-
-
- /// <summary>
- /// Model context size (n_ctx)
- /// </summary>
- public uint ContextSize { get; set; } = 512;
- /// <summary>
- /// the GPU that is used for scratch and small tensors
- /// </summary>
- public int MainGpu { get; set; } = 0;
- /// <summary>
- /// if true, reduce VRAM usage at the cost of performance
- /// </summary>
- public bool LowVram { get; set; } = false;
- /// <summary>
- /// Number of layers to run in VRAM / GPU memory (n_gpu_layers)
- /// </summary>
- public int GpuLayerCount { get; set; } = 20;
- /// <summary>
- /// Seed for the random number generator (seed)
- /// </summary>
- public uint Seed { get; set; } = 1686349486;
- /// <summary>
- /// Use f16 instead of f32 for memory kv (memory_f16)
- /// </summary>
- public bool UseFp16Memory { get; set; } = true;
- /// <summary>
- /// Use mmap for faster loads (use_mmap)
- /// </summary>
- public bool UseMemorymap { get; set; } = true;
- /// <summary>
- /// Use mlock to keep model in memory (use_mlock)
- /// </summary>
- public bool UseMemoryLock { get; set; } = false;
- /// <summary>
- /// Compute perplexity over the prompt (perplexity)
- /// </summary>
- public bool Perplexity { get; set; } = false;
- /// <summary>
- /// Model path (model)
- /// </summary>
- public string ModelPath { get; set; }
-
- /// <summary>
- /// List of LoRAs to apply
- /// </summary>
- public AdapterCollection LoraAdapters { get; set; } = new();
-
- /// <summary>
- /// base model path for the lora adapter (lora_base)
- /// </summary>
- public string LoraBase { get; set; } = string.Empty;
- /// <summary>
- /// Number of threads (-1 = autodetect) (n_threads)
- /// </summary>
- public int Threads { get; set; } = Math.Max(Environment.ProcessorCount / 2, 1);
- /// <summary>
- /// batch size for prompt processing (must be >=32 to use BLAS) (n_batch)
- /// </summary>
- public uint BatchSize { get; set; } = 512;
-
- /// <summary>
- /// Whether to convert eos to newline during the inference.
- /// </summary>
- public bool ConvertEosToNewLine { get; set; } = false;
-
- /// <summary>
- /// Whether to use embedding mode. (embedding) Note that if this is set to true,
- /// The LLamaModel won't produce text response anymore.
- /// </summary>
- public bool EmbeddingMode { get; set; } = false;
-
- /// <summary>
- /// how split tensors should be distributed across GPUs
- /// </summary>
- public float[] TensorSplits { get; set; }
-
- /// <summary>
- /// RoPE base frequency
- /// </summary>
- public float RopeFrequencyBase { get; set; } = 10000.0f;
-
- /// <summary>
- /// RoPE frequency scaling factor
- /// </summary>
- public float RopeFrequencyScale { get; set; } = 1.0f;
-
- /// <summary>
- /// Use experimental mul_mat_q kernels
- /// </summary>
- public bool MulMatQ { get; set; }
-
- /// <summary>
- /// The encoding to use for models
- /// </summary>
- public Encoding Encoding { get; set; } = Encoding.UTF8;
-
- /// <summary>
- /// Load vocab only (no weights)
- /// </summary>
- public bool VocabOnly { get; set; }
- }
- }
|