correct minicpm model type (size)

This commit is contained in:
vincent 2024-02-06 16:07:38 +08:00
parent b5d00541f5
commit f9cf07881a

View file

@ -1415,6 +1415,7 @@ enum e_model {
MODEL_UNKNOWN, MODEL_UNKNOWN,
MODEL_0_5B, MODEL_0_5B,
MODEL_1B, MODEL_1B,
MODEL_2B,
MODEL_3B, MODEL_3B,
MODEL_4B, MODEL_4B,
MODEL_7B, MODEL_7B,
@ -2773,6 +2774,7 @@ static std::string llama_model_ftype_name(llama_ftype ftype) {
static const char * llama_model_type_name(e_model type) { static const char * llama_model_type_name(e_model type) {
switch (type) { switch (type) {
case MODEL_1B: return "1B"; case MODEL_1B: return "1B";
case MODEL_2B: return "2B";
case MODEL_3B: return "3B"; case MODEL_3B: return "3B";
case MODEL_7B: return "7B"; case MODEL_7B: return "7B";
case MODEL_8B: return "8B"; case MODEL_8B: return "8B";
@ -2898,8 +2900,6 @@ static void llm_load_hparams(
// arch-specific KVs // arch-specific KVs
switch (model.arch) { switch (model.arch) {
case LLM_ARCH_LLAMA: case LLM_ARCH_LLAMA:
//TODO: add minicpm specific KVs
case LLM_ARCH_MINICPM:
{ {
ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps); ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);
@ -2914,6 +2914,13 @@ static void llm_load_hparams(
default: model.type = e_model::MODEL_UNKNOWN; default: model.type = e_model::MODEL_UNKNOWN;
} }
} break; } break;
case LLM_ARCH_MINICPM:
{
switch (hparams.n_layer) {
case 40: model.type = e_model::MODEL_2B; break;
default: model.type = e_model::MODEL_UNKNOWN;
}
} break;
case LLM_ARCH_FALCON: case LLM_ARCH_FALCON:
{ {
ml.get_key(LLM_KV_ATTENTION_LAYERNORM_EPS, hparams.f_norm_eps); ml.get_key(LLM_KV_ATTENTION_LAYERNORM_EPS, hparams.f_norm_eps);