11diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp
2- index 15fb9d0b..c0472daa 100644
2+ index ba7bf959..c908b7aa 100644
33--- a/src/llama-arch.cpp
44+++ b/src/llama-arch.cpp
55@@ -17,6 +17,7 @@ static const std::map<llm_arch, const char *> LLM_ARCH_NAMES = {
@@ -10,7 +10,7 @@ index 15fb9d0b..c0472daa 100644
1010 { LLM_ARCH_BERT, "bert" },
1111 { LLM_ARCH_NOMIC_BERT, "nomic-bert" },
1212 { LLM_ARCH_NOMIC_BERT_MOE, "nomic-bert-moe" },
13- @@ -481 ,6 +482 ,22 @@ static const std::map<llm_arch, std::map<llm_tensor, const char *>> LLM_TENSOR_N
13+ @@ -482 ,6 +483 ,22 @@ static const std::map<llm_arch, std::map<llm_tensor, const char *>> LLM_TENSOR_N
1414 { LLM_TENSOR_FFN_UP, "blk.%d.ffn_up" },
1515 },
1616 },
@@ -34,7 +34,7 @@ index 15fb9d0b..c0472daa 100644
3434 LLM_ARCH_BERT,
3535 {
3636diff --git a/src/llama-arch.h b/src/llama-arch.h
37- index 8ea80806..27728c0d 100644
37+ index 9b8bd65b..48f62367 100644
3838--- a/src/llama-arch.h
3939+++ b/src/llama-arch.h
4040@@ -21,6 +21,7 @@ enum llm_arch {
@@ -46,7 +46,7 @@ index 8ea80806..27728c0d 100644
4646 LLM_ARCH_NOMIC_BERT,
4747 LLM_ARCH_NOMIC_BERT_MOE,
4848diff --git a/src/llama-model.cpp b/src/llama-model.cpp
49- index 3983a693..c2b01fa5 100644
49+ index 60a615c1..9c130b7d 100644
5050--- a/src/llama-model.cpp
5151+++ b/src/llama-model.cpp
5252@@ -757,6 +757,16 @@ void llama_model::load_hparams(llama_model_loader & ml) {
@@ -66,15 +66,15 @@ index 3983a693..c2b01fa5 100644
6666 case LLM_ARCH_NOMIC_BERT:
6767 case LLM_ARCH_NOMIC_BERT_MOE:
6868 {
69- @@ -2539 ,6 +2549 ,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
69+ @@ -2552 ,6 +2562 ,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
7070 layer.ffn_up_b = create_tensor(tn(LLM_TENSOR_FFN_UP, "bias", i), {n_ff}, 0);
7171 }
7272 } break;
7373+ case LLM_ARCH_NEW:
7474 case LLM_ARCH_BERT:
7575 case LLM_ARCH_NOMIC_BERT:
7676 case LLM_ARCH_NOMIC_BERT_MOE:
77- @@ -2546 ,7 +2557 ,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
77+ @@ -2559 ,7 +2570 ,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
7878 tok_embd = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, 0);
7979 type_embd = create_tensor(tn(LLM_TENSOR_TOKEN_TYPES, "weight"), {n_embd, n_token_types}, TENSOR_NOT_REQUIRED);
8080
@@ -83,7 +83,7 @@ index 3983a693..c2b01fa5 100644
8383 pos_embd = create_tensor(tn(LLM_TENSOR_POS_EMBD, "weight"), {n_embd, n_ctx_train}, 0);
8484
8585 cls = create_tensor(tn(LLM_TENSOR_CLS, "weight"), {n_embd, n_embd}, TENSOR_NOT_REQUIRED);
86- @@ -2587 ,12 +2598 ,16 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
86+ @@ -2600 ,12 +2611 ,16 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
8787 layer.ffn_down_exps = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "weight", i), { n_ff, n_embd, n_expert}, 0);
8888 layer.ffn_gate_inp = create_tensor(tn(LLM_TENSOR_FFN_GATE_INP, "weight", i), {n_embd, n_expert}, 0);
8989 } else {
@@ -103,7 +103,7 @@ index 3983a693..c2b01fa5 100644
103103 layer.ffn_down_b = create_tensor(tn(LLM_TENSOR_FFN_DOWN, "bias", i), {n_embd}, 0);
104104 } else {
105105 layer.ffn_gate = create_tensor(tn(LLM_TENSOR_FFN_GATE, "weight", i), {n_embd, n_ff}, 0);
106- @@ -7093 ,7 +7108 ,7 @@ struct llm_build_bert : public llm_graph_context {
106+ @@ -7139 ,7 +7154 ,7 @@ struct llm_build_bert : public llm_graph_context {
107107 ggml_tensor * type_row0 = ggml_view_1d(ctx0, model.type_embd, n_embd, 0);
108108 inpL = ggml_add(ctx0, inpL, type_row0);
109109 }
@@ -112,7 +112,7 @@ index 3983a693..c2b01fa5 100644
112112 inpL = ggml_add(ctx0, ggml_get_rows(ctx0, model.pos_embd, inp_pos), inpL);
113113 }
114114 cb(inpL, "inp_embd", -1);
115- @@ -7152 ,7 +7167 ,7 @@ struct llm_build_bert : public llm_graph_context {
115+ @@ -7198 ,7 +7213 ,7 @@ struct llm_build_bert : public llm_graph_context {
116116 Vcur = ggml_reshape_3d(ctx0, Vcur, n_embd_head, n_head_kv, n_tokens);
117117
118118 // RoPE
@@ -121,7 +121,7 @@ index 3983a693..c2b01fa5 100644
121121 Qcur = ggml_rope_ext(
122122 ctx0, Qcur, inp_pos, nullptr,
123123 n_rot, rope_type, n_ctx_orig, freq_base, freq_scale,
124- @@ -7211 ,6 +7226 ,13 @@ struct llm_build_bert : public llm_graph_context {
124+ @@ -7257 ,6 +7272 ,13 @@ struct llm_build_bert : public llm_graph_context {
125125 0.0f,
126126 LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX, il);
127127 cb(cur, "ffn_moe_out", il);
@@ -135,15 +135,15 @@ index 3983a693..c2b01fa5 100644
135135 } else if (model.arch == LLM_ARCH_BERT || model.arch == LLM_ARCH_NOMIC_BERT_MOE) {
136136 cur = build_ffn(cur,
137137 model.layers[il].ffn_up, model.layers[il].ffn_up_b, NULL,
138- @@ -17371 ,6 +17393 ,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params,
138+ @@ -17555 ,6 +17577 ,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params,
139139 switch (arch) {
140140 // Models that need specific instantiation should be handled in the
141141 // switch statement
142142+ case LLM_ARCH_NEW:
143143 case LLM_ARCH_BERT:
144144 case LLM_ARCH_JINA_BERT_V2:
145145 case LLM_ARCH_NOMIC_BERT:
146- @@ -17983 ,6 +18006 ,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) {
146+ @@ -18172 ,6 +18195 ,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) {
147147 case LLM_ARCH_FALCON_H1:
148148 case LLM_ARCH_GROK:
149149 case LLM_ARCH_DBRX:
0 commit comments