| 14286 | } |
| 14287 | |
| 14288 | const char * llama_model_chat_template(const llama_model * model, const char * name) { |
| 14289 | const auto key = name ? LLM_KV(model->arch, name)(LLM_KV_TOKENIZER_CHAT_TEMPLATE_N) |
| 14290 | : LLM_KV(model->arch)(LLM_KV_TOKENIZER_CHAT_TEMPLATE); |
| 14291 | const auto & it = model->gguf_kv.find(key); |
| 14292 | if (it == model->gguf_kv.end()) { |
| 14293 | // one-off fix for very popular models (so we are not flooded with issues) |
| 14294 | // do not extend this list unless absolutely necessary |
| 14295 | // Mistral-Small-2503 does not have built-in chat template |
| 14296 | llama_vocab_pre_type pre_type = model->vocab.get_pre_type(); |
| 14297 | if (pre_type == LLAMA_VOCAB_PRE_TYPE_TEKKEN && model->layers.size() == 40) { |
| 14298 | return "mistral-v7-tekken"; |
| 14299 | } |
| 14300 | |
| 14301 | return nullptr; |
| 14302 | } |
| 14303 | |
| 14304 | return it->second.c_str(); |
| 14305 | } |
| 14306 | |
| 14307 | uint64_t llama_model_n_params(const llama_model * model) { |
| 14308 | return model->n_elements(); |
no test coverage detected