MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / common_params

Class common_params

subprojects/llama.cpp/common/common.h:360–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358struct ggml_opt_optimizer_params common_opt_lr_pars(void * userdata);
359
360struct common_params {
361 int32_t n_predict = -1; // max. number of new tokens to predict, -1 == no limit
362 int32_t n_ctx = 0; // context size, 0 == context the model was trained with
363 int32_t n_batch = 2048; // logical batch size for prompt processing (must be >=32 to use BLAS)
364 int32_t n_ubatch = 512; // physical batch size for prompt processing (must be >=32 to use BLAS)
365 int32_t n_keep = 0; // number of tokens to keep from initial prompt
366 int32_t n_chunks = -1; // max number of chunks to process (-1 = unlimited)
367 int32_t n_parallel = 1; // number of parallel sequences to decode
368 int32_t n_sequences = 1; // number of sequences to decode
369 int32_t grp_attn_n = 1; // group-attention factor
370 int32_t grp_attn_w = 512; // group-attention width
371 int32_t n_print = -1; // print token count every n tokens (-1 = disabled)
372 float rope_freq_base = 0.0f; // RoPE base frequency
373 float rope_freq_scale = 0.0f; // RoPE frequency scaling factor
374 float yarn_ext_factor = -1.0f; // YaRN extrapolation mix factor
375 float yarn_attn_factor = -1.0f; // YaRN magnitude scaling factor
376 float yarn_beta_fast = -1.0f; // YaRN low correction dim
377 float yarn_beta_slow = -1.0f; // YaRN high correction dim
378 int32_t yarn_orig_ctx = 0; // YaRN original context length
379
380 // offload params
381 std::vector<ggml_backend_dev_t> devices; // devices to use for offloading
382
383 int32_t n_gpu_layers = -1; // number of layers to store in VRAM, -1 is auto, <= -2 is all
384 int32_t main_gpu = 0; // the GPU that is used for scratch and small tensors
385 float tensor_split[128] = {0}; // how split tensors should be distributed across GPUs
386 bool fit_params = true; // whether to fit unset model/context parameters to free device memory
387 int32_t fit_params_min_ctx = 4096; // minimum context size to set when trying to reduce memory use
388
389 // margin per device in bytes for fitting parameters to free memory:
390 std::vector<size_t> fit_params_target = std::vector<size_t>(llama_max_devices(), 1024 * 1024*1024);
391
392 enum llama_split_mode split_mode = LLAMA_SPLIT_MODE_LAYER; // how to split the model across GPUs
393
394 struct cpu_params cpuparams;
395 struct cpu_params cpuparams_batch;
396
397 ggml_backend_sched_eval_callback cb_eval = nullptr;
398 void * cb_eval_user_data = nullptr;
399
400 ggml_numa_strategy numa = GGML_NUMA_STRATEGY_DISABLED;
401
402 enum llama_rope_scaling_type rope_scaling_type = LLAMA_ROPE_SCALING_TYPE_UNSPECIFIED;
403 enum llama_pooling_type pooling_type = LLAMA_POOLING_TYPE_UNSPECIFIED; // pooling type for embeddings
404 enum llama_attention_type attention_type = LLAMA_ATTENTION_TYPE_UNSPECIFIED; // attention type for embeddings
405 enum llama_flash_attn_type flash_attn_type = LLAMA_FLASH_ATTN_TYPE_AUTO; // whether to use Flash Attention
406
407 struct common_params_sampling sampling;
408 struct common_params_speculative speculative;
409 struct common_params_vocoder vocoder;
410 struct common_params_diffusion diffusion;
411
412 struct common_params_model model;
413
414 std::string model_alias = ""; // model alias // NOLINT
415 std::string hf_token = ""; // HF token // NOLINT
416 std::string prompt = ""; // NOLINT
417 std::string system_prompt = ""; // NOLINT

Callers

nothing calls this directly

Calls 1

llama_max_devicesFunction · 0.85

Tested by

no test coverage detected