| 2182 | // |
| 2183 | |
| 2184 | llama_context_params llama_context_default_params() { |
| 2185 | llama_context_params result = { |
| 2186 | /*.n_ctx =*/ 512, |
| 2187 | /*.n_batch =*/ 2048, |
| 2188 | /*.n_ubatch =*/ 512, |
| 2189 | /*.n_seq_max =*/ 1, |
| 2190 | /*.n_threads =*/ GGML_DEFAULT_N_THREADS, // TODO: better default |
| 2191 | /*.n_threads_batch =*/ GGML_DEFAULT_N_THREADS, |
| 2192 | /*.rope_scaling_type =*/ LLAMA_ROPE_SCALING_TYPE_UNSPECIFIED, |
| 2193 | /*.pooling_type =*/ LLAMA_POOLING_TYPE_UNSPECIFIED, |
| 2194 | /*.attention_type =*/ LLAMA_ATTENTION_TYPE_UNSPECIFIED, |
| 2195 | /*.rope_freq_base =*/ 0.0f, |
| 2196 | /*.rope_freq_scale =*/ 0.0f, |
| 2197 | /*.yarn_ext_factor =*/ -1.0f, |
| 2198 | /*.yarn_attn_factor =*/ 1.0f, |
| 2199 | /*.yarn_beta_fast =*/ 32.0f, |
| 2200 | /*.yarn_beta_slow =*/ 1.0f, |
| 2201 | /*.yarn_orig_ctx =*/ 0, |
| 2202 | /*.defrag_thold =*/ -1.0f, |
| 2203 | /*.cb_eval =*/ nullptr, |
| 2204 | /*.cb_eval_user_data =*/ nullptr, |
| 2205 | /*.type_k =*/ GGML_TYPE_F16, |
| 2206 | /*.type_v =*/ GGML_TYPE_F16, |
| 2207 | /*.abort_callback =*/ nullptr, |
| 2208 | /*.abort_callback_data =*/ nullptr, |
| 2209 | /*.embeddings =*/ false, |
| 2210 | /*.offload_kqv =*/ true, |
| 2211 | /*.flash_attn =*/ false, |
| 2212 | /*.no_perf =*/ true, |
| 2213 | /*.op_offload =*/ true, |
| 2214 | /*.swa_full =*/ true, |
| 2215 | }; |
| 2216 | |
| 2217 | return result; |
| 2218 | } |
| 2219 | |
| 2220 | llama_context * llama_init_from_model( |
| 2221 | llama_model * model, |