Upload folder using huggingface_hub
Browse files- config.json +37 -0
- generation_config.json +6 -0
- interpretation/examples-0.pkl +3 -0
- interpretation/examples-1.pkl +3 -0
- interpretation/examples-2.pkl +3 -0
- interpretation/examples-3.pkl +3 -0
- interpretation/examples-4.pkl +3 -0
- interpretation/examples-5.pkl +3 -0
- interpretation/examples-6.pkl +3 -0
- interpretation/examples-7.pkl +3 -0
- interpretation/inputs.pt +3 -0
- interpretation/routings-0.pkl +3 -0
- interpretation/routings-1.pkl +3 -0
- interpretation/routings-2.pkl +3 -0
- interpretation/routings-3.pkl +3 -0
- interpretation/routings-4.pkl +3 -0
- interpretation/routings-5.pkl +3 -0
- interpretation/routings-6.pkl +3 -0
- interpretation/routings-7.pkl +3 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +586 -0
- modeling_monet.py +663 -0
- special_tokens_map.json +23 -0
- tokenizer.model +3 -0
- tokenizer_config.json +43 -0
config.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": ["MonetForCausalLM"],
|
| 3 |
+
"attention_bias": false,
|
| 4 |
+
"attention_dropout": 0.0,
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoConfig": "modeling_monet.MonetConfig",
|
| 7 |
+
"AutoModelForCausalLM": "modeling_monet.MonetForCausalLM"
|
| 8 |
+
},
|
| 9 |
+
"bos_token_id": 1,
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"hidden_act": "relu2",
|
| 12 |
+
"hidden_size": 3072,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": null,
|
| 15 |
+
"max_position_embeddings": 2048,
|
| 16 |
+
"mlp_bias": null,
|
| 17 |
+
"model_type": "monet",
|
| 18 |
+
"moe_decompose": "vertical",
|
| 19 |
+
"moe_dim": 24,
|
| 20 |
+
"moe_experts": 512,
|
| 21 |
+
"moe_groups": 4,
|
| 22 |
+
"moe_heads": 12,
|
| 23 |
+
"moe_topk": 8,
|
| 24 |
+
"num_attention_heads": 24,
|
| 25 |
+
"num_hidden_layers": 32,
|
| 26 |
+
"num_key_value_heads": 24,
|
| 27 |
+
"output_router_probs": false,
|
| 28 |
+
"pretraining_tp": 1,
|
| 29 |
+
"rms_norm_eps": 1e-6,
|
| 30 |
+
"rope_scaling": null,
|
| 31 |
+
"rope_theta": 10000.0,
|
| 32 |
+
"tie_word_embeddings": false,
|
| 33 |
+
"torch_dtype": "bfloat16",
|
| 34 |
+
"transformers_version": "4.44.2",
|
| 35 |
+
"use_cache": true,
|
| 36 |
+
"vocab_size": 32000
|
| 37 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"transformers_version": "4.44.2"
|
| 6 |
+
}
|
interpretation/examples-0.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a6fa25d480ce0f8757def13084b7d7a17abd7029da0781686fed1586ee97ca1
|
| 3 |
+
size 131466479
|
interpretation/examples-1.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b533695375c5d07b9b7befcd06ffc70b66f4fd037143e726ab7d40aafee8164
|
| 3 |
+
size 370184015
|
interpretation/examples-2.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3dcbfd290e26c738a148c46b665ea889f0079e140edccc27880e13f6cc519bbc
|
| 3 |
+
size 330305905
|
interpretation/examples-3.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:257f2e669c7a74c4ac97785a52ab399f7bf8dfd32309549aea2c057b8826f37d
|
| 3 |
+
size 326833157
|
interpretation/examples-4.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6b95b9dc2bd45055307d090a25b1987df5b940ca8937b66d9155058eac627d6
|
| 3 |
+
size 367214039
|
interpretation/examples-5.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7c02f4247c84f286e5ae7bcae85c24b51ad90ed41aacc83b77656a4fd2c6691
|
| 3 |
+
size 396063525
|
interpretation/examples-6.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:45a6bd63004ce2695e9986c00ab0264df56b3c6438be705fabeb6cf174fc427e
|
| 3 |
+
size 400323805
|
interpretation/examples-7.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2af2e0def4a0c5c274fdbf2e91e3eca80941fa178562e7b08d19509a8b1d0120
|
| 3 |
+
size 387813131
|
interpretation/inputs.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d8dfa78c58772da42d1be1995a039672f4d4ed95e319b1fe94fe8a4d0980eb7
|
| 3 |
+
size 393938007
|
interpretation/routings-0.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f698af3294aea8159251c61a13c7bf279abad7b229b1d7e08f1f0c9f8e71210
|
| 3 |
+
size 9014683873
|
interpretation/routings-1.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ead12ee49310d45e03c82c49feced14990633df24f9c71b0543f79e7915a9f2
|
| 3 |
+
size 11678536677
|
interpretation/routings-2.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b98a6a5308987b69e4cf6669b482ec8fe88055b47fc03ba361831ce7b6eb6079
|
| 3 |
+
size 9398043059
|
interpretation/routings-3.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:51984878889eb6eb5b9d8cde97f10c1f37de9bbc5cddd9bbe91267b44245e45d
|
| 3 |
+
size 6722608619
|
interpretation/routings-4.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7e5009a156b9c347178e4f4576ec0acf3b242e222d9585806e7a24012509c5f
|
| 3 |
+
size 7572154455
|
interpretation/routings-5.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:258da30fbdf3df6c128d95289856f21d90d9bc6d04aeb451e6ab7a7a4575122c
|
| 3 |
+
size 8736531053
|
interpretation/routings-6.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e708210d7d8c5cf4a5f9ff822330159a1fb4d4f98435c40e50fba7ecbef76207
|
| 3 |
+
size 10045081221
|
interpretation/routings-7.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dfba557f17b0bdbfcf586766db2a9168b0fd1aa902a530cb23c3108d41d189c3
|
| 3 |
+
size 10420552384
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cadca3b054a15a013415292c07d45dbd47583ef1f0bdf694c58739f286112d2e
|
| 3 |
+
size 4994582160
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54f1e2964bf923a976612e5ef7defcb18f0b4aff42ea45501baee5a93ac451f0
|
| 3 |
+
size 3352284128
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,586 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 8346803072
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"lm_head.weight": "model-00002-of-00002.safetensors",
|
| 7 |
+
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
| 8 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 9 |
+
"model.layers.0.moe.b1": "model-00001-of-00002.safetensors",
|
| 10 |
+
"model.layers.0.moe.b2": "model-00001-of-00002.safetensors",
|
| 11 |
+
"model.layers.0.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 12 |
+
"model.layers.0.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 13 |
+
"model.layers.0.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 14 |
+
"model.layers.0.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 15 |
+
"model.layers.0.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 16 |
+
"model.layers.0.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 17 |
+
"model.layers.0.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 18 |
+
"model.layers.0.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 19 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 20 |
+
"model.layers.0.router.norm1.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 21 |
+
"model.layers.0.router.norm1.running_mean": "model-00001-of-00002.safetensors",
|
| 22 |
+
"model.layers.0.router.norm1.running_var": "model-00001-of-00002.safetensors",
|
| 23 |
+
"model.layers.0.router.norm2.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 24 |
+
"model.layers.0.router.norm2.running_mean": "model-00001-of-00002.safetensors",
|
| 25 |
+
"model.layers.0.router.norm2.running_var": "model-00001-of-00002.safetensors",
|
| 26 |
+
"model.layers.0.router.w1.weight": "model-00001-of-00002.safetensors",
|
| 27 |
+
"model.layers.0.router.w2.weight": "model-00001-of-00002.safetensors",
|
| 28 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 29 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 30 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 31 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 32 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 33 |
+
"model.layers.1.moe.b1": "model-00001-of-00002.safetensors",
|
| 34 |
+
"model.layers.1.moe.b2": "model-00001-of-00002.safetensors",
|
| 35 |
+
"model.layers.1.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 36 |
+
"model.layers.1.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 37 |
+
"model.layers.1.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 38 |
+
"model.layers.1.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 39 |
+
"model.layers.1.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 40 |
+
"model.layers.1.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 41 |
+
"model.layers.1.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 42 |
+
"model.layers.1.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 43 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 44 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 45 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 46 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 47 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 48 |
+
"model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 49 |
+
"model.layers.10.moe.b1": "model-00001-of-00002.safetensors",
|
| 50 |
+
"model.layers.10.moe.b2": "model-00001-of-00002.safetensors",
|
| 51 |
+
"model.layers.10.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 52 |
+
"model.layers.10.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 53 |
+
"model.layers.10.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 54 |
+
"model.layers.10.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 55 |
+
"model.layers.10.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 56 |
+
"model.layers.10.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 57 |
+
"model.layers.10.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 58 |
+
"model.layers.10.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 59 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 60 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 61 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 62 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 63 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 64 |
+
"model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 65 |
+
"model.layers.11.moe.b1": "model-00001-of-00002.safetensors",
|
| 66 |
+
"model.layers.11.moe.b2": "model-00001-of-00002.safetensors",
|
| 67 |
+
"model.layers.11.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 68 |
+
"model.layers.11.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 69 |
+
"model.layers.11.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 70 |
+
"model.layers.11.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 71 |
+
"model.layers.11.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 72 |
+
"model.layers.11.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 73 |
+
"model.layers.11.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 74 |
+
"model.layers.11.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 75 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 76 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 77 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 78 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 79 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 80 |
+
"model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 81 |
+
"model.layers.12.moe.b1": "model-00001-of-00002.safetensors",
|
| 82 |
+
"model.layers.12.moe.b2": "model-00001-of-00002.safetensors",
|
| 83 |
+
"model.layers.12.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 84 |
+
"model.layers.12.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 85 |
+
"model.layers.12.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 86 |
+
"model.layers.12.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 87 |
+
"model.layers.12.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 88 |
+
"model.layers.12.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 89 |
+
"model.layers.12.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 90 |
+
"model.layers.12.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 91 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 92 |
+
"model.layers.12.router.norm1.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 93 |
+
"model.layers.12.router.norm1.running_mean": "model-00001-of-00002.safetensors",
|
| 94 |
+
"model.layers.12.router.norm1.running_var": "model-00001-of-00002.safetensors",
|
| 95 |
+
"model.layers.12.router.norm2.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 96 |
+
"model.layers.12.router.norm2.running_mean": "model-00001-of-00002.safetensors",
|
| 97 |
+
"model.layers.12.router.norm2.running_var": "model-00001-of-00002.safetensors",
|
| 98 |
+
"model.layers.12.router.w1.weight": "model-00001-of-00002.safetensors",
|
| 99 |
+
"model.layers.12.router.w2.weight": "model-00001-of-00002.safetensors",
|
| 100 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 101 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 102 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 103 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 104 |
+
"model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 105 |
+
"model.layers.13.moe.b1": "model-00001-of-00002.safetensors",
|
| 106 |
+
"model.layers.13.moe.b2": "model-00001-of-00002.safetensors",
|
| 107 |
+
"model.layers.13.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 108 |
+
"model.layers.13.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 109 |
+
"model.layers.13.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 110 |
+
"model.layers.13.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 111 |
+
"model.layers.13.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 112 |
+
"model.layers.13.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 113 |
+
"model.layers.13.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 114 |
+
"model.layers.13.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 115 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 116 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 117 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 118 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 119 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 120 |
+
"model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 121 |
+
"model.layers.14.moe.b1": "model-00001-of-00002.safetensors",
|
| 122 |
+
"model.layers.14.moe.b2": "model-00001-of-00002.safetensors",
|
| 123 |
+
"model.layers.14.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 124 |
+
"model.layers.14.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 125 |
+
"model.layers.14.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 126 |
+
"model.layers.14.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 127 |
+
"model.layers.14.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 128 |
+
"model.layers.14.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 129 |
+
"model.layers.14.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 130 |
+
"model.layers.14.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 131 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 132 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 133 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 134 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 135 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 136 |
+
"model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 137 |
+
"model.layers.15.moe.b1": "model-00001-of-00002.safetensors",
|
| 138 |
+
"model.layers.15.moe.b2": "model-00001-of-00002.safetensors",
|
| 139 |
+
"model.layers.15.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 140 |
+
"model.layers.15.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 141 |
+
"model.layers.15.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 142 |
+
"model.layers.15.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 143 |
+
"model.layers.15.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 144 |
+
"model.layers.15.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 145 |
+
"model.layers.15.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 146 |
+
"model.layers.15.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 147 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 148 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 149 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 150 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 151 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 152 |
+
"model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 153 |
+
"model.layers.16.moe.b1": "model-00001-of-00002.safetensors",
|
| 154 |
+
"model.layers.16.moe.b2": "model-00001-of-00002.safetensors",
|
| 155 |
+
"model.layers.16.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 156 |
+
"model.layers.16.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 157 |
+
"model.layers.16.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 158 |
+
"model.layers.16.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 159 |
+
"model.layers.16.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 160 |
+
"model.layers.16.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 161 |
+
"model.layers.16.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 162 |
+
"model.layers.16.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 163 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 164 |
+
"model.layers.16.router.norm1.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 165 |
+
"model.layers.16.router.norm1.running_mean": "model-00001-of-00002.safetensors",
|
| 166 |
+
"model.layers.16.router.norm1.running_var": "model-00001-of-00002.safetensors",
|
| 167 |
+
"model.layers.16.router.norm2.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 168 |
+
"model.layers.16.router.norm2.running_mean": "model-00001-of-00002.safetensors",
|
| 169 |
+
"model.layers.16.router.norm2.running_var": "model-00001-of-00002.safetensors",
|
| 170 |
+
"model.layers.16.router.w1.weight": "model-00001-of-00002.safetensors",
|
| 171 |
+
"model.layers.16.router.w2.weight": "model-00001-of-00002.safetensors",
|
| 172 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 173 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 174 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 175 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 176 |
+
"model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 177 |
+
"model.layers.17.moe.b1": "model-00001-of-00002.safetensors",
|
| 178 |
+
"model.layers.17.moe.b2": "model-00001-of-00002.safetensors",
|
| 179 |
+
"model.layers.17.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 180 |
+
"model.layers.17.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 181 |
+
"model.layers.17.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 182 |
+
"model.layers.17.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 183 |
+
"model.layers.17.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 184 |
+
"model.layers.17.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 185 |
+
"model.layers.17.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 186 |
+
"model.layers.17.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 187 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 188 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 189 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 190 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 191 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 192 |
+
"model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 193 |
+
"model.layers.18.moe.b1": "model-00001-of-00002.safetensors",
|
| 194 |
+
"model.layers.18.moe.b2": "model-00001-of-00002.safetensors",
|
| 195 |
+
"model.layers.18.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 196 |
+
"model.layers.18.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 197 |
+
"model.layers.18.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 198 |
+
"model.layers.18.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 199 |
+
"model.layers.18.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 200 |
+
"model.layers.18.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 201 |
+
"model.layers.18.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 202 |
+
"model.layers.18.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 203 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 204 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 205 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 206 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 207 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 208 |
+
"model.layers.19.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 209 |
+
"model.layers.19.moe.b1": "model-00002-of-00002.safetensors",
|
| 210 |
+
"model.layers.19.moe.b2": "model-00002-of-00002.safetensors",
|
| 211 |
+
"model.layers.19.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 212 |
+
"model.layers.19.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 213 |
+
"model.layers.19.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 214 |
+
"model.layers.19.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 215 |
+
"model.layers.19.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 216 |
+
"model.layers.19.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 217 |
+
"model.layers.19.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 218 |
+
"model.layers.19.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 219 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 220 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 221 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 222 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 223 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 224 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 225 |
+
"model.layers.2.moe.b1": "model-00001-of-00002.safetensors",
|
| 226 |
+
"model.layers.2.moe.b2": "model-00001-of-00002.safetensors",
|
| 227 |
+
"model.layers.2.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 228 |
+
"model.layers.2.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 229 |
+
"model.layers.2.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 230 |
+
"model.layers.2.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 231 |
+
"model.layers.2.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 232 |
+
"model.layers.2.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 233 |
+
"model.layers.2.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 234 |
+
"model.layers.2.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 235 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 236 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 237 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 238 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 239 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 240 |
+
"model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 241 |
+
"model.layers.20.moe.b1": "model-00002-of-00002.safetensors",
|
| 242 |
+
"model.layers.20.moe.b2": "model-00002-of-00002.safetensors",
|
| 243 |
+
"model.layers.20.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 244 |
+
"model.layers.20.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 245 |
+
"model.layers.20.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 246 |
+
"model.layers.20.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 247 |
+
"model.layers.20.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 248 |
+
"model.layers.20.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 249 |
+
"model.layers.20.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 250 |
+
"model.layers.20.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 251 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 252 |
+
"model.layers.20.router.norm1.num_batches_tracked": "model-00002-of-00002.safetensors",
|
| 253 |
+
"model.layers.20.router.norm1.running_mean": "model-00002-of-00002.safetensors",
|
| 254 |
+
"model.layers.20.router.norm1.running_var": "model-00002-of-00002.safetensors",
|
| 255 |
+
"model.layers.20.router.norm2.num_batches_tracked": "model-00002-of-00002.safetensors",
|
| 256 |
+
"model.layers.20.router.norm2.running_mean": "model-00002-of-00002.safetensors",
|
| 257 |
+
"model.layers.20.router.norm2.running_var": "model-00002-of-00002.safetensors",
|
| 258 |
+
"model.layers.20.router.w1.weight": "model-00002-of-00002.safetensors",
|
| 259 |
+
"model.layers.20.router.w2.weight": "model-00002-of-00002.safetensors",
|
| 260 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 261 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 262 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 263 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 264 |
+
"model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 265 |
+
"model.layers.21.moe.b1": "model-00002-of-00002.safetensors",
|
| 266 |
+
"model.layers.21.moe.b2": "model-00002-of-00002.safetensors",
|
| 267 |
+
"model.layers.21.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 268 |
+
"model.layers.21.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 269 |
+
"model.layers.21.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 270 |
+
"model.layers.21.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 271 |
+
"model.layers.21.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 272 |
+
"model.layers.21.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 273 |
+
"model.layers.21.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 274 |
+
"model.layers.21.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 275 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 276 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 277 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 278 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 279 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 280 |
+
"model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 281 |
+
"model.layers.22.moe.b1": "model-00002-of-00002.safetensors",
|
| 282 |
+
"model.layers.22.moe.b2": "model-00002-of-00002.safetensors",
|
| 283 |
+
"model.layers.22.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 284 |
+
"model.layers.22.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 285 |
+
"model.layers.22.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 286 |
+
"model.layers.22.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 287 |
+
"model.layers.22.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 288 |
+
"model.layers.22.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 289 |
+
"model.layers.22.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 290 |
+
"model.layers.22.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 291 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 292 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 293 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 294 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 295 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 296 |
+
"model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 297 |
+
"model.layers.23.moe.b1": "model-00002-of-00002.safetensors",
|
| 298 |
+
"model.layers.23.moe.b2": "model-00002-of-00002.safetensors",
|
| 299 |
+
"model.layers.23.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 300 |
+
"model.layers.23.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 301 |
+
"model.layers.23.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 302 |
+
"model.layers.23.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 303 |
+
"model.layers.23.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 304 |
+
"model.layers.23.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 305 |
+
"model.layers.23.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 306 |
+
"model.layers.23.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 307 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 308 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 309 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 310 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 311 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 312 |
+
"model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 313 |
+
"model.layers.24.moe.b1": "model-00002-of-00002.safetensors",
|
| 314 |
+
"model.layers.24.moe.b2": "model-00002-of-00002.safetensors",
|
| 315 |
+
"model.layers.24.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 316 |
+
"model.layers.24.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 317 |
+
"model.layers.24.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 318 |
+
"model.layers.24.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 319 |
+
"model.layers.24.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 320 |
+
"model.layers.24.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 321 |
+
"model.layers.24.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 322 |
+
"model.layers.24.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 323 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 324 |
+
"model.layers.24.router.norm1.num_batches_tracked": "model-00002-of-00002.safetensors",
|
| 325 |
+
"model.layers.24.router.norm1.running_mean": "model-00002-of-00002.safetensors",
|
| 326 |
+
"model.layers.24.router.norm1.running_var": "model-00002-of-00002.safetensors",
|
| 327 |
+
"model.layers.24.router.norm2.num_batches_tracked": "model-00002-of-00002.safetensors",
|
| 328 |
+
"model.layers.24.router.norm2.running_mean": "model-00002-of-00002.safetensors",
|
| 329 |
+
"model.layers.24.router.norm2.running_var": "model-00002-of-00002.safetensors",
|
| 330 |
+
"model.layers.24.router.w1.weight": "model-00002-of-00002.safetensors",
|
| 331 |
+
"model.layers.24.router.w2.weight": "model-00002-of-00002.safetensors",
|
| 332 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 333 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 334 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 335 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 336 |
+
"model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 337 |
+
"model.layers.25.moe.b1": "model-00002-of-00002.safetensors",
|
| 338 |
+
"model.layers.25.moe.b2": "model-00002-of-00002.safetensors",
|
| 339 |
+
"model.layers.25.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 340 |
+
"model.layers.25.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 341 |
+
"model.layers.25.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 342 |
+
"model.layers.25.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 343 |
+
"model.layers.25.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 344 |
+
"model.layers.25.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 345 |
+
"model.layers.25.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 346 |
+
"model.layers.25.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 347 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 348 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 349 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 350 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 351 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 352 |
+
"model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 353 |
+
"model.layers.26.moe.b1": "model-00002-of-00002.safetensors",
|
| 354 |
+
"model.layers.26.moe.b2": "model-00002-of-00002.safetensors",
|
| 355 |
+
"model.layers.26.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 356 |
+
"model.layers.26.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 357 |
+
"model.layers.26.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 358 |
+
"model.layers.26.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 359 |
+
"model.layers.26.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 360 |
+
"model.layers.26.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 361 |
+
"model.layers.26.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 362 |
+
"model.layers.26.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 363 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 364 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 365 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 366 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 367 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 368 |
+
"model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 369 |
+
"model.layers.27.moe.b1": "model-00002-of-00002.safetensors",
|
| 370 |
+
"model.layers.27.moe.b2": "model-00002-of-00002.safetensors",
|
| 371 |
+
"model.layers.27.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 372 |
+
"model.layers.27.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 373 |
+
"model.layers.27.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 374 |
+
"model.layers.27.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 375 |
+
"model.layers.27.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 376 |
+
"model.layers.27.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 377 |
+
"model.layers.27.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 378 |
+
"model.layers.27.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 379 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 380 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 381 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 382 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 383 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 384 |
+
"model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 385 |
+
"model.layers.28.moe.b1": "model-00002-of-00002.safetensors",
|
| 386 |
+
"model.layers.28.moe.b2": "model-00002-of-00002.safetensors",
|
| 387 |
+
"model.layers.28.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 388 |
+
"model.layers.28.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 389 |
+
"model.layers.28.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 390 |
+
"model.layers.28.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 391 |
+
"model.layers.28.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 392 |
+
"model.layers.28.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 393 |
+
"model.layers.28.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 394 |
+
"model.layers.28.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 395 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 396 |
+
"model.layers.28.router.norm1.num_batches_tracked": "model-00002-of-00002.safetensors",
|
| 397 |
+
"model.layers.28.router.norm1.running_mean": "model-00002-of-00002.safetensors",
|
| 398 |
+
"model.layers.28.router.norm1.running_var": "model-00002-of-00002.safetensors",
|
| 399 |
+
"model.layers.28.router.norm2.num_batches_tracked": "model-00002-of-00002.safetensors",
|
| 400 |
+
"model.layers.28.router.norm2.running_mean": "model-00002-of-00002.safetensors",
|
| 401 |
+
"model.layers.28.router.norm2.running_var": "model-00002-of-00002.safetensors",
|
| 402 |
+
"model.layers.28.router.w1.weight": "model-00002-of-00002.safetensors",
|
| 403 |
+
"model.layers.28.router.w2.weight": "model-00002-of-00002.safetensors",
|
| 404 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 405 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 406 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 407 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 408 |
+
"model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 409 |
+
"model.layers.29.moe.b1": "model-00002-of-00002.safetensors",
|
| 410 |
+
"model.layers.29.moe.b2": "model-00002-of-00002.safetensors",
|
| 411 |
+
"model.layers.29.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 412 |
+
"model.layers.29.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 413 |
+
"model.layers.29.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 414 |
+
"model.layers.29.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 415 |
+
"model.layers.29.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 416 |
+
"model.layers.29.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 417 |
+
"model.layers.29.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 418 |
+
"model.layers.29.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 419 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 420 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 421 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 422 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 423 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 424 |
+
"model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 425 |
+
"model.layers.3.moe.b1": "model-00001-of-00002.safetensors",
|
| 426 |
+
"model.layers.3.moe.b2": "model-00001-of-00002.safetensors",
|
| 427 |
+
"model.layers.3.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 428 |
+
"model.layers.3.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 429 |
+
"model.layers.3.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 430 |
+
"model.layers.3.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 431 |
+
"model.layers.3.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 432 |
+
"model.layers.3.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 433 |
+
"model.layers.3.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 434 |
+
"model.layers.3.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 435 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 436 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 437 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 438 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 439 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 440 |
+
"model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 441 |
+
"model.layers.30.moe.b1": "model-00002-of-00002.safetensors",
|
| 442 |
+
"model.layers.30.moe.b2": "model-00002-of-00002.safetensors",
|
| 443 |
+
"model.layers.30.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 444 |
+
"model.layers.30.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 445 |
+
"model.layers.30.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 446 |
+
"model.layers.30.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 447 |
+
"model.layers.30.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 448 |
+
"model.layers.30.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 449 |
+
"model.layers.30.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 450 |
+
"model.layers.30.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 451 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 452 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 453 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 454 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 455 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 456 |
+
"model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 457 |
+
"model.layers.31.moe.b1": "model-00002-of-00002.safetensors",
|
| 458 |
+
"model.layers.31.moe.b2": "model-00002-of-00002.safetensors",
|
| 459 |
+
"model.layers.31.moe.u1.bias": "model-00002-of-00002.safetensors",
|
| 460 |
+
"model.layers.31.moe.u1.weight": "model-00002-of-00002.safetensors",
|
| 461 |
+
"model.layers.31.moe.u2.bias": "model-00002-of-00002.safetensors",
|
| 462 |
+
"model.layers.31.moe.u2.weight": "model-00002-of-00002.safetensors",
|
| 463 |
+
"model.layers.31.moe.v11.weight": "model-00002-of-00002.safetensors",
|
| 464 |
+
"model.layers.31.moe.v12.weight": "model-00002-of-00002.safetensors",
|
| 465 |
+
"model.layers.31.moe.v21.weight": "model-00002-of-00002.safetensors",
|
| 466 |
+
"model.layers.31.moe.v22.weight": "model-00002-of-00002.safetensors",
|
| 467 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 468 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 469 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 470 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 471 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 472 |
+
"model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 473 |
+
"model.layers.4.moe.b1": "model-00001-of-00002.safetensors",
|
| 474 |
+
"model.layers.4.moe.b2": "model-00001-of-00002.safetensors",
|
| 475 |
+
"model.layers.4.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 476 |
+
"model.layers.4.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 477 |
+
"model.layers.4.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 478 |
+
"model.layers.4.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 479 |
+
"model.layers.4.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 480 |
+
"model.layers.4.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 481 |
+
"model.layers.4.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 482 |
+
"model.layers.4.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 483 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 484 |
+
"model.layers.4.router.norm1.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 485 |
+
"model.layers.4.router.norm1.running_mean": "model-00001-of-00002.safetensors",
|
| 486 |
+
"model.layers.4.router.norm1.running_var": "model-00001-of-00002.safetensors",
|
| 487 |
+
"model.layers.4.router.norm2.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 488 |
+
"model.layers.4.router.norm2.running_mean": "model-00001-of-00002.safetensors",
|
| 489 |
+
"model.layers.4.router.norm2.running_var": "model-00001-of-00002.safetensors",
|
| 490 |
+
"model.layers.4.router.w1.weight": "model-00001-of-00002.safetensors",
|
| 491 |
+
"model.layers.4.router.w2.weight": "model-00001-of-00002.safetensors",
|
| 492 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 493 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 494 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 495 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 496 |
+
"model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 497 |
+
"model.layers.5.moe.b1": "model-00001-of-00002.safetensors",
|
| 498 |
+
"model.layers.5.moe.b2": "model-00001-of-00002.safetensors",
|
| 499 |
+
"model.layers.5.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 500 |
+
"model.layers.5.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 501 |
+
"model.layers.5.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 502 |
+
"model.layers.5.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 503 |
+
"model.layers.5.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 504 |
+
"model.layers.5.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 505 |
+
"model.layers.5.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 506 |
+
"model.layers.5.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 507 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 508 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 509 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 510 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 511 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 512 |
+
"model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 513 |
+
"model.layers.6.moe.b1": "model-00001-of-00002.safetensors",
|
| 514 |
+
"model.layers.6.moe.b2": "model-00001-of-00002.safetensors",
|
| 515 |
+
"model.layers.6.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 516 |
+
"model.layers.6.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 517 |
+
"model.layers.6.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 518 |
+
"model.layers.6.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 519 |
+
"model.layers.6.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 520 |
+
"model.layers.6.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 521 |
+
"model.layers.6.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 522 |
+
"model.layers.6.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 523 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 524 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 525 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 526 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 527 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 528 |
+
"model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 529 |
+
"model.layers.7.moe.b1": "model-00001-of-00002.safetensors",
|
| 530 |
+
"model.layers.7.moe.b2": "model-00001-of-00002.safetensors",
|
| 531 |
+
"model.layers.7.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 532 |
+
"model.layers.7.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 533 |
+
"model.layers.7.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 534 |
+
"model.layers.7.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 535 |
+
"model.layers.7.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 536 |
+
"model.layers.7.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 537 |
+
"model.layers.7.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 538 |
+
"model.layers.7.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 539 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 540 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 541 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 542 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 543 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 544 |
+
"model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 545 |
+
"model.layers.8.moe.b1": "model-00001-of-00002.safetensors",
|
| 546 |
+
"model.layers.8.moe.b2": "model-00001-of-00002.safetensors",
|
| 547 |
+
"model.layers.8.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 548 |
+
"model.layers.8.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 549 |
+
"model.layers.8.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 550 |
+
"model.layers.8.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 551 |
+
"model.layers.8.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 552 |
+
"model.layers.8.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 553 |
+
"model.layers.8.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 554 |
+
"model.layers.8.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 555 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 556 |
+
"model.layers.8.router.norm1.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 557 |
+
"model.layers.8.router.norm1.running_mean": "model-00001-of-00002.safetensors",
|
| 558 |
+
"model.layers.8.router.norm1.running_var": "model-00001-of-00002.safetensors",
|
| 559 |
+
"model.layers.8.router.norm2.num_batches_tracked": "model-00001-of-00002.safetensors",
|
| 560 |
+
"model.layers.8.router.norm2.running_mean": "model-00001-of-00002.safetensors",
|
| 561 |
+
"model.layers.8.router.norm2.running_var": "model-00001-of-00002.safetensors",
|
| 562 |
+
"model.layers.8.router.w1.weight": "model-00001-of-00002.safetensors",
|
| 563 |
+
"model.layers.8.router.w2.weight": "model-00001-of-00002.safetensors",
|
| 564 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 565 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 566 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 567 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 568 |
+
"model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 569 |
+
"model.layers.9.moe.b1": "model-00001-of-00002.safetensors",
|
| 570 |
+
"model.layers.9.moe.b2": "model-00001-of-00002.safetensors",
|
| 571 |
+
"model.layers.9.moe.u1.bias": "model-00001-of-00002.safetensors",
|
| 572 |
+
"model.layers.9.moe.u1.weight": "model-00001-of-00002.safetensors",
|
| 573 |
+
"model.layers.9.moe.u2.bias": "model-00001-of-00002.safetensors",
|
| 574 |
+
"model.layers.9.moe.u2.weight": "model-00001-of-00002.safetensors",
|
| 575 |
+
"model.layers.9.moe.v11.weight": "model-00001-of-00002.safetensors",
|
| 576 |
+
"model.layers.9.moe.v12.weight": "model-00001-of-00002.safetensors",
|
| 577 |
+
"model.layers.9.moe.v21.weight": "model-00001-of-00002.safetensors",
|
| 578 |
+
"model.layers.9.moe.v22.weight": "model-00001-of-00002.safetensors",
|
| 579 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 580 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 581 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 582 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 583 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 584 |
+
"model.norm.weight": "model-00002-of-00002.safetensors"
|
| 585 |
+
}
|
| 586 |
+
}
|
modeling_monet.py
ADDED
|
@@ -0,0 +1,663 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# fmt: off
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
+
import torch.utils.checkpoint
|
| 8 |
+
from scipy.stats import norm
|
| 9 |
+
from torch import nn
|
| 10 |
+
from torch.nn import CrossEntropyLoss
|
| 11 |
+
from transformers.activations import ACT2FN
|
| 12 |
+
from transformers.cache_utils import Cache, DynamicCache, StaticCache
|
| 13 |
+
from transformers.modeling_attn_mask_utils import AttentionMaskConverter
|
| 14 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 15 |
+
from transformers.models.llama.configuration_llama import LlamaConfig
|
| 16 |
+
from transformers.models.llama.modeling_llama import (
|
| 17 |
+
LLAMA_ATTENTION_CLASSES,
|
| 18 |
+
LlamaRMSNorm,
|
| 19 |
+
)
|
| 20 |
+
from transformers.utils import ModelOutput, logging
|
| 21 |
+
|
| 22 |
+
logger = logging.get_logger(__name__)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
@dataclass
|
| 26 |
+
class MonetModelOutputWithPast(ModelOutput):
|
| 27 |
+
last_hidden_state: torch.FloatTensor = None
|
| 28 |
+
past_key_values: tuple[tuple[torch.FloatTensor]] | None = None
|
| 29 |
+
hidden_states: tuple[torch.FloatTensor, ...] | None = None
|
| 30 |
+
attentions: tuple[torch.FloatTensor, ...] | None = None
|
| 31 |
+
router_probs: tuple[tuple[torch.FloatTensor, ...], ...] | None = None
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@dataclass
|
| 35 |
+
class MonetCausalLMOutputWithPast(ModelOutput):
|
| 36 |
+
loss: torch.FloatTensor | None = None
|
| 37 |
+
aux_loss: torch.FloatTensor | None = None
|
| 38 |
+
logits: torch.FloatTensor = None
|
| 39 |
+
past_key_values: tuple[tuple[torch.FloatTensor]] | None = None
|
| 40 |
+
hidden_states: tuple[torch.FloatTensor, ...] | None = None
|
| 41 |
+
attentions: tuple[torch.FloatTensor, ...] | None = None
|
| 42 |
+
router_probs: tuple[tuple[torch.FloatTensor, ...], ...] | None = None
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class MonetConfig(LlamaConfig):
|
| 46 |
+
model_type = "monet"
|
| 47 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 48 |
+
|
| 49 |
+
def __init__(
|
| 50 |
+
self,
|
| 51 |
+
vocab_size=32000,
|
| 52 |
+
hidden_size=4096,
|
| 53 |
+
intermediate_size=None,
|
| 54 |
+
num_hidden_layers=32,
|
| 55 |
+
num_attention_heads=32,
|
| 56 |
+
num_key_value_heads=None,
|
| 57 |
+
hidden_act="relu2",
|
| 58 |
+
max_position_embeddings=2048,
|
| 59 |
+
initializer_range=0.02,
|
| 60 |
+
rms_norm_eps=1e-6,
|
| 61 |
+
use_cache=True,
|
| 62 |
+
pad_token_id=None,
|
| 63 |
+
bos_token_id=1,
|
| 64 |
+
eos_token_id=2,
|
| 65 |
+
pretraining_tp=1,
|
| 66 |
+
tie_word_embeddings=False,
|
| 67 |
+
rope_theta=10000.0,
|
| 68 |
+
rope_scaling=None,
|
| 69 |
+
attention_bias=False,
|
| 70 |
+
attention_dropout=0.0,
|
| 71 |
+
mlp_bias=None,
|
| 72 |
+
moe_dim=8,
|
| 73 |
+
moe_heads=8,
|
| 74 |
+
moe_experts=512,
|
| 75 |
+
moe_topk=32,
|
| 76 |
+
moe_groups=4,
|
| 77 |
+
moe_decompose="vertical",
|
| 78 |
+
output_router_probs=False,
|
| 79 |
+
**kwargs,
|
| 80 |
+
):
|
| 81 |
+
self.moe_dim = moe_dim
|
| 82 |
+
self.moe_heads = moe_heads
|
| 83 |
+
self.moe_experts = moe_experts
|
| 84 |
+
self.moe_topk = moe_topk
|
| 85 |
+
self.moe_groups = moe_groups
|
| 86 |
+
self.moe_decompose = moe_decompose
|
| 87 |
+
self.output_router_probs = output_router_probs
|
| 88 |
+
|
| 89 |
+
super().__init__(
|
| 90 |
+
vocab_size=vocab_size,
|
| 91 |
+
hidden_size=hidden_size,
|
| 92 |
+
intermediate_size=intermediate_size,
|
| 93 |
+
num_hidden_layers=num_hidden_layers,
|
| 94 |
+
num_attention_heads=num_attention_heads,
|
| 95 |
+
num_key_value_heads=num_key_value_heads,
|
| 96 |
+
hidden_act=hidden_act,
|
| 97 |
+
max_position_embeddings=max_position_embeddings,
|
| 98 |
+
initializer_range=initializer_range,
|
| 99 |
+
rms_norm_eps=rms_norm_eps,
|
| 100 |
+
use_cache=use_cache,
|
| 101 |
+
pad_token_id=pad_token_id,
|
| 102 |
+
bos_token_id=bos_token_id,
|
| 103 |
+
eos_token_id=eos_token_id,
|
| 104 |
+
pretraining_tp=pretraining_tp,
|
| 105 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 106 |
+
rope_theta=rope_theta,
|
| 107 |
+
rope_scaling=rope_scaling,
|
| 108 |
+
attention_bias=attention_bias,
|
| 109 |
+
attention_dropout=attention_dropout,
|
| 110 |
+
mlp_bias=mlp_bias,
|
| 111 |
+
**kwargs,
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
class MonetRouter(nn.Module):
|
| 116 |
+
def __init__(self, config: MonetConfig):
|
| 117 |
+
super().__init__()
|
| 118 |
+
self.config = config
|
| 119 |
+
flatten_shape = config.moe_heads * config.moe_experts
|
| 120 |
+
|
| 121 |
+
self.w1 = nn.Linear(config.hidden_size, flatten_shape, bias=False)
|
| 122 |
+
self.w2 = nn.Linear(config.hidden_size, flatten_shape, bias=False)
|
| 123 |
+
self.norm1 = nn.BatchNorm1d(config.moe_heads, affine=False)
|
| 124 |
+
self.norm2 = nn.BatchNorm1d(config.moe_heads, affine=False)
|
| 125 |
+
|
| 126 |
+
def forward(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
|
| 127 |
+
g1z = self.w1(x).unflatten(-1, (self.config.moe_heads, -1)).float()
|
| 128 |
+
g2z = self.w2(x).unflatten(-1, (self.config.moe_heads, -1)).float()
|
| 129 |
+
|
| 130 |
+
g1n = self.norm1(g1z.transpose(2, 3).flatten(0, -2))
|
| 131 |
+
g2n = self.norm2(g2z.transpose(2, 3).flatten(0, -2))
|
| 132 |
+
g1n = g1n.view(g1z.size(0), g1z.size(1), g1z.size(3), -1).transpose(2, 3)
|
| 133 |
+
g2n = g2n.view(g2z.size(0), g2z.size(1), g2z.size(3), -1).transpose(2, 3)
|
| 134 |
+
|
| 135 |
+
sigma = float(norm.ppf(1 - self.config.moe_topk / self.config.moe_experts))
|
| 136 |
+
g1s = g1n.amax(-1, keepdim=True).clamp_max_(sigma)
|
| 137 |
+
g2s = g2n.amax(-1, keepdim=True).clamp_max_(sigma)
|
| 138 |
+
|
| 139 |
+
g1 = nn.functional.softmax(torch.where(g1n >= g1s, g1z, -1e10), dim=-1)
|
| 140 |
+
g2 = nn.functional.softmax(torch.where(g2n >= g2s, g2z, -1e10), dim=-1)
|
| 141 |
+
return g1, g2
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class MonetMoVDE(nn.Module):
|
| 145 |
+
def __init__(self, config: MonetConfig):
|
| 146 |
+
super().__init__()
|
| 147 |
+
self.config = config
|
| 148 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 149 |
+
flatten_shape = config.moe_experts * config.moe_dim // 2
|
| 150 |
+
|
| 151 |
+
self.u1 = nn.Linear(config.hidden_size, flatten_shape)
|
| 152 |
+
self.u2 = nn.Linear(config.hidden_size, flatten_shape)
|
| 153 |
+
|
| 154 |
+
self.v11 = nn.Linear(flatten_shape, config.hidden_size // 2, bias=False)
|
| 155 |
+
self.v12 = nn.Linear(flatten_shape, config.hidden_size // 2, bias=False)
|
| 156 |
+
self.v21 = nn.Linear(flatten_shape, config.hidden_size // 2, bias=False)
|
| 157 |
+
self.v22 = nn.Linear(flatten_shape, config.hidden_size // 2, bias=False)
|
| 158 |
+
|
| 159 |
+
self.b1 = nn.Parameter(torch.zeros(config.moe_experts, config.hidden_size // 2))
|
| 160 |
+
self.b2 = nn.Parameter(torch.zeros(config.moe_experts, config.hidden_size // 2))
|
| 161 |
+
|
| 162 |
+
def forward(
|
| 163 |
+
self, x: torch.Tensor, g1: torch.Tensor, g2: torch.Tensor
|
| 164 |
+
) -> torch.Tensor:
|
| 165 |
+
g1, g2 = g1.type_as(x), g2.type_as(x)
|
| 166 |
+
x1 = self.act_fn(self.u1(x).unflatten(-1, (self.config.moe_experts, -1)))
|
| 167 |
+
x2 = self.act_fn(self.u2(x).unflatten(-1, (self.config.moe_experts, -1)))
|
| 168 |
+
|
| 169 |
+
x11 = self.v11(torch.einsum("btim,bthi->btim", x1, g1).flatten(-2))
|
| 170 |
+
x12 = self.v12(torch.einsum("btjm,bthj,bthi->btim", x2, g2, g1).flatten(-2))
|
| 171 |
+
x13 = torch.einsum("bthi,id->btd", g1, self.b1.type_as(x))
|
| 172 |
+
|
| 173 |
+
x21 = self.v21(torch.einsum("btim,bthi,bthj->btjm", x1, g1, g2).flatten(-2))
|
| 174 |
+
x22 = self.v22(torch.einsum("btjm,bthj->btjm", x2, g2).flatten(-2))
|
| 175 |
+
x23 = torch.einsum("bthj,jd->btd", g2, self.b2.type_as(x))
|
| 176 |
+
|
| 177 |
+
return torch.cat((x11 + x12 + x13, x21 + x22 + x23), dim=-1)
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
class MonetMoHDE(nn.Module):
|
| 181 |
+
def __init__(self, config: MonetConfig):
|
| 182 |
+
super().__init__()
|
| 183 |
+
self.config = config
|
| 184 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 185 |
+
flatten_shape = config.moe_experts * config.moe_dim
|
| 186 |
+
|
| 187 |
+
self.u = nn.Linear(config.hidden_size, flatten_shape)
|
| 188 |
+
self.v = nn.Linear(flatten_shape, config.hidden_size, bias=False)
|
| 189 |
+
self.b = nn.Parameter(torch.zeros(config.moe_experts, config.hidden_size))
|
| 190 |
+
|
| 191 |
+
def forward(
|
| 192 |
+
self, x: torch.Tensor, g1: torch.Tensor, g2: torch.Tensor
|
| 193 |
+
) -> torch.Tensor:
|
| 194 |
+
g1, g2 = g1.type_as(x), g2.type_as(x)
|
| 195 |
+
x = self.act_fn(self.u(x).unflatten(-1, (self.config.moe_experts, -1)))
|
| 196 |
+
x = self.v(torch.einsum("btim,bthi,bthj->btjm", x, g1, g2).flatten(-2))
|
| 197 |
+
return x + torch.einsum("bthj,jd->btd", g2, self.b)
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
class MonetDecoderLayer(nn.Module):
|
| 201 |
+
def __init__(self, config: MonetConfig, layer_idx: int):
|
| 202 |
+
super().__init__()
|
| 203 |
+
self.hidden_size = config.hidden_size
|
| 204 |
+
self.self_attn = LLAMA_ATTENTION_CLASSES[config._attn_implementation](
|
| 205 |
+
config=config, layer_idx=layer_idx
|
| 206 |
+
)
|
| 207 |
+
self.input_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 208 |
+
self.post_attention_layernorm = LlamaRMSNorm(
|
| 209 |
+
config.hidden_size, eps=config.rms_norm_eps
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
if config.moe_decompose == "vertical":
|
| 213 |
+
self.moe = MonetMoVDE(config)
|
| 214 |
+
elif config.moe_decompose == "horizontal":
|
| 215 |
+
self.moe = MonetMoHDE(config)
|
| 216 |
+
if layer_idx % config.moe_groups == 0:
|
| 217 |
+
self.router = MonetRouter(config).requires_grad_(False)
|
| 218 |
+
|
| 219 |
+
def forward(
|
| 220 |
+
self,
|
| 221 |
+
hidden_states: torch.Tensor,
|
| 222 |
+
attention_mask: torch.Tensor | None = None,
|
| 223 |
+
position_ids: torch.LongTensor | None = None,
|
| 224 |
+
past_key_value: Cache | None = None,
|
| 225 |
+
previous_router_probs: tuple[torch.Tensor, torch.Tensor] | None = None,
|
| 226 |
+
output_attentions: bool | None = False,
|
| 227 |
+
use_cache: bool | None = False,
|
| 228 |
+
cache_position: torch.LongTensor | None = None,
|
| 229 |
+
**kwargs,
|
| 230 |
+
) -> tuple[torch.FloatTensor, ...]:
|
| 231 |
+
residual = hidden_states
|
| 232 |
+
|
| 233 |
+
hidden_states = self.input_layernorm(hidden_states)
|
| 234 |
+
|
| 235 |
+
# Self Attention
|
| 236 |
+
hidden_states, self_attn_weights, present_key_value = self.self_attn(
|
| 237 |
+
hidden_states=hidden_states,
|
| 238 |
+
attention_mask=attention_mask,
|
| 239 |
+
position_ids=position_ids,
|
| 240 |
+
past_key_value=past_key_value,
|
| 241 |
+
output_attentions=output_attentions,
|
| 242 |
+
use_cache=use_cache,
|
| 243 |
+
cache_position=cache_position,
|
| 244 |
+
)
|
| 245 |
+
hidden_states = residual + hidden_states
|
| 246 |
+
|
| 247 |
+
# Fully Connected
|
| 248 |
+
residual = hidden_states
|
| 249 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
| 250 |
+
g1, g2 = (
|
| 251 |
+
self.router(hidden_states)
|
| 252 |
+
if hasattr(self, "router")
|
| 253 |
+
else previous_router_probs
|
| 254 |
+
)
|
| 255 |
+
hidden_states = self.moe(hidden_states, g1, g2)
|
| 256 |
+
hidden_states = residual + hidden_states
|
| 257 |
+
|
| 258 |
+
outputs = (hidden_states,)
|
| 259 |
+
|
| 260 |
+
if output_attentions:
|
| 261 |
+
outputs += (self_attn_weights,)
|
| 262 |
+
|
| 263 |
+
if use_cache:
|
| 264 |
+
outputs += (present_key_value,)
|
| 265 |
+
|
| 266 |
+
return outputs + ((g1, g2) if hasattr(self, "router") else None,)
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class MonetPreTrainedModel(PreTrainedModel):
|
| 270 |
+
config_class = MonetConfig
|
| 271 |
+
base_model_prefix = "model"
|
| 272 |
+
supports_gradient_checkpointing = True
|
| 273 |
+
_no_split_modules = ["MonetDecoderLayer"]
|
| 274 |
+
_skip_keys_device_placement = ["past_key_values"]
|
| 275 |
+
_supports_flash_attn_2 = True
|
| 276 |
+
_supports_sdpa = True
|
| 277 |
+
_supports_cache_class = True
|
| 278 |
+
_supports_quantized_cache = True
|
| 279 |
+
_supports_static_cache = True
|
| 280 |
+
|
| 281 |
+
def _init_weights(self, module):
|
| 282 |
+
std = self.config.initializer_range
|
| 283 |
+
if isinstance(module, nn.Linear):
|
| 284 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
| 285 |
+
if module.bias is not None:
|
| 286 |
+
module.bias.data.zero_()
|
| 287 |
+
elif isinstance(module, nn.Embedding):
|
| 288 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
| 289 |
+
if module.padding_idx is not None:
|
| 290 |
+
module.weight.data[module.padding_idx].zero_()
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
class MonetModel(MonetPreTrainedModel):
|
| 294 |
+
def __init__(self, config: MonetConfig):
|
| 295 |
+
super().__init__(config)
|
| 296 |
+
self.padding_idx = config.pad_token_id
|
| 297 |
+
self.vocab_size = config.vocab_size
|
| 298 |
+
|
| 299 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) # noqa
|
| 300 |
+
self.layers = nn.ModuleList([MonetDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]) # noqa
|
| 301 |
+
self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 302 |
+
self.gradient_checkpointing = False
|
| 303 |
+
|
| 304 |
+
# Initialize weights and apply final processing
|
| 305 |
+
self.post_init()
|
| 306 |
+
|
| 307 |
+
def get_input_embeddings(self):
|
| 308 |
+
return self.embed_tokens
|
| 309 |
+
|
| 310 |
+
def set_input_embeddings(self, value):
|
| 311 |
+
self.embed_tokens = value
|
| 312 |
+
|
| 313 |
+
def forward(
|
| 314 |
+
self,
|
| 315 |
+
input_ids: torch.LongTensor = None,
|
| 316 |
+
attention_mask: torch.Tensor | None = None,
|
| 317 |
+
position_ids: torch.LongTensor | None = None,
|
| 318 |
+
past_key_values: Cache | list[torch.FloatTensor] | None = None,
|
| 319 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 320 |
+
use_cache: bool | None = None,
|
| 321 |
+
output_attentions: bool | None = None,
|
| 322 |
+
output_hidden_states: bool | None = None,
|
| 323 |
+
output_router_probs: bool | None = None,
|
| 324 |
+
return_dict: bool | None = None,
|
| 325 |
+
cache_position: torch.LongTensor | None = None,
|
| 326 |
+
) -> tuple[torch.Tensor, ...] | MonetModelOutputWithPast:
|
| 327 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions # noqa
|
| 328 |
+
output_hidden_states = output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states # noqa
|
| 329 |
+
output_router_probs = output_router_probs if output_router_probs is not None else self.config.output_router_probs # noqa
|
| 330 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
| 331 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict # noqa
|
| 332 |
+
|
| 333 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 334 |
+
raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one") # noqa
|
| 335 |
+
|
| 336 |
+
if self.gradient_checkpointing and self.training and use_cache:
|
| 337 |
+
logger.warning_once("`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`.") # noqa
|
| 338 |
+
use_cache = False
|
| 339 |
+
|
| 340 |
+
if inputs_embeds is None:
|
| 341 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 342 |
+
|
| 343 |
+
return_legacy_cache = False
|
| 344 |
+
if use_cache and not isinstance(past_key_values, Cache): # kept for BC (non `Cache` `past_key_values` inputs) # noqa
|
| 345 |
+
return_legacy_cache = True
|
| 346 |
+
past_key_values = DynamicCache.from_legacy_cache(past_key_values)
|
| 347 |
+
logger.warning_once(
|
| 348 |
+
"We detected that you are passing `past_key_values` as a tuple and this is deprecated and will be removed in v4.43. " # noqa
|
| 349 |
+
"Please use an appropriate `Cache` class (https://huggingface.co/docs/transformers/v4.41.3/en/internal/generation_utils#transformers.Cache)" # noqa
|
| 350 |
+
)
|
| 351 |
+
|
| 352 |
+
if cache_position is None:
|
| 353 |
+
past_seen_tokens = (
|
| 354 |
+
past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 355 |
+
)
|
| 356 |
+
cache_position = torch.arange(past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device) # noqa
|
| 357 |
+
if position_ids is None:
|
| 358 |
+
position_ids = cache_position.unsqueeze(0)
|
| 359 |
+
causal_mask = self._update_causal_mask(attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions) # noqa
|
| 360 |
+
|
| 361 |
+
# embed positions
|
| 362 |
+
hidden_states = inputs_embeds
|
| 363 |
+
|
| 364 |
+
# decoder layers
|
| 365 |
+
all_hidden_states = () if output_hidden_states else None
|
| 366 |
+
all_self_attns = () if output_attentions else None
|
| 367 |
+
all_router_probs = () if output_router_probs else None
|
| 368 |
+
previous_router_probs, next_decoder_cache = None, None
|
| 369 |
+
|
| 370 |
+
for decoder_layer in self.layers:
|
| 371 |
+
if output_hidden_states:
|
| 372 |
+
all_hidden_states += (hidden_states,)
|
| 373 |
+
|
| 374 |
+
if self.gradient_checkpointing and self.training:
|
| 375 |
+
layer_outputs = self._gradient_checkpointing_func(
|
| 376 |
+
decoder_layer.__call__,
|
| 377 |
+
hidden_states,
|
| 378 |
+
causal_mask,
|
| 379 |
+
position_ids,
|
| 380 |
+
past_key_values,
|
| 381 |
+
previous_router_probs,
|
| 382 |
+
output_attentions,
|
| 383 |
+
use_cache,
|
| 384 |
+
cache_position,
|
| 385 |
+
)
|
| 386 |
+
else:
|
| 387 |
+
layer_outputs = decoder_layer(
|
| 388 |
+
hidden_states,
|
| 389 |
+
attention_mask=causal_mask,
|
| 390 |
+
position_ids=position_ids,
|
| 391 |
+
past_key_value=past_key_values,
|
| 392 |
+
previous_router_probs=previous_router_probs,
|
| 393 |
+
output_attentions=output_attentions,
|
| 394 |
+
use_cache=use_cache,
|
| 395 |
+
cache_position=cache_position,
|
| 396 |
+
)
|
| 397 |
+
|
| 398 |
+
hidden_states = layer_outputs[0]
|
| 399 |
+
if use_cache:
|
| 400 |
+
next_decoder_cache = layer_outputs[2 if output_attentions else 1]
|
| 401 |
+
if output_attentions:
|
| 402 |
+
all_self_attns += (layer_outputs[1],)
|
| 403 |
+
if output_router_probs:
|
| 404 |
+
all_router_probs += (layer_outputs[-1],)
|
| 405 |
+
previous_router_probs = (
|
| 406 |
+
layer_outputs[-1]
|
| 407 |
+
if layer_outputs[-1] is not None
|
| 408 |
+
else previous_router_probs
|
| 409 |
+
)
|
| 410 |
+
|
| 411 |
+
hidden_states = self.norm(hidden_states)
|
| 412 |
+
|
| 413 |
+
# add hidden states from the last decoder layer
|
| 414 |
+
if output_hidden_states:
|
| 415 |
+
all_hidden_states += (hidden_states,)
|
| 416 |
+
|
| 417 |
+
next_cache = next_decoder_cache if use_cache else None
|
| 418 |
+
if return_legacy_cache:
|
| 419 |
+
next_cache = next_cache.to_legacy_cache()
|
| 420 |
+
|
| 421 |
+
if not return_dict:
|
| 422 |
+
return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns, all_router_probs] if v is not None) # noqa
|
| 423 |
+
return MonetModelOutputWithPast(
|
| 424 |
+
last_hidden_state=hidden_states,
|
| 425 |
+
past_key_values=next_cache,
|
| 426 |
+
hidden_states=all_hidden_states,
|
| 427 |
+
attentions=all_self_attns,
|
| 428 |
+
router_probs=all_router_probs,
|
| 429 |
+
)
|
| 430 |
+
|
| 431 |
+
def _update_causal_mask(
|
| 432 |
+
self,
|
| 433 |
+
attention_mask: torch.Tensor,
|
| 434 |
+
input_tensor: torch.Tensor,
|
| 435 |
+
cache_position: torch.Tensor,
|
| 436 |
+
past_key_values: Cache,
|
| 437 |
+
output_attentions: bool,
|
| 438 |
+
):
|
| 439 |
+
if self.config._attn_implementation == "flash_attention_2":
|
| 440 |
+
if attention_mask is not None and 0.0 in attention_mask:
|
| 441 |
+
return attention_mask
|
| 442 |
+
return None
|
| 443 |
+
|
| 444 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0 # noqa
|
| 445 |
+
using_static_cache = isinstance(past_key_values, StaticCache)
|
| 446 |
+
|
| 447 |
+
if self.config._attn_implementation == "sdpa" and not using_static_cache and not output_attentions: # noqa
|
| 448 |
+
if AttentionMaskConverter._ignore_causal_mask_sdpa(
|
| 449 |
+
attention_mask,
|
| 450 |
+
inputs_embeds=input_tensor,
|
| 451 |
+
past_key_values_length=past_seen_tokens,
|
| 452 |
+
is_training=self.training,
|
| 453 |
+
):
|
| 454 |
+
return None
|
| 455 |
+
|
| 456 |
+
dtype, device = input_tensor.dtype, input_tensor.device
|
| 457 |
+
min_dtype = torch.finfo(dtype).min
|
| 458 |
+
sequence_length = input_tensor.shape[1]
|
| 459 |
+
if using_static_cache:
|
| 460 |
+
target_length = past_key_values.get_max_length()
|
| 461 |
+
else:
|
| 462 |
+
target_length = (
|
| 463 |
+
attention_mask.shape[-1]
|
| 464 |
+
if isinstance(attention_mask, torch.Tensor)
|
| 465 |
+
else past_seen_tokens + sequence_length + 1
|
| 466 |
+
)
|
| 467 |
+
|
| 468 |
+
if attention_mask is not None and attention_mask.dim() == 4:
|
| 469 |
+
if attention_mask.max() != 0:
|
| 470 |
+
raise ValueError("Custom 4D attention mask should be passed in inverted form with max==0`") # noqa
|
| 471 |
+
causal_mask = attention_mask
|
| 472 |
+
else:
|
| 473 |
+
causal_mask = torch.full(
|
| 474 |
+
(sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=device # noqa
|
| 475 |
+
)
|
| 476 |
+
if sequence_length != 1:
|
| 477 |
+
causal_mask = torch.triu(causal_mask, diagonal=1)
|
| 478 |
+
causal_mask *= torch.arange(target_length, device=device) > cache_position.reshape(-1, 1) # noqa
|
| 479 |
+
causal_mask = causal_mask[None, None, :, :].expand(input_tensor.shape[0], 1, -1, -1) # noqa
|
| 480 |
+
if attention_mask is not None:
|
| 481 |
+
causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit # noqa
|
| 482 |
+
mask_length = attention_mask.shape[-1]
|
| 483 |
+
padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :] # noqa
|
| 484 |
+
padding_mask = padding_mask == 0
|
| 485 |
+
causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(padding_mask, min_dtype) # noqa
|
| 486 |
+
if (
|
| 487 |
+
self.config._attn_implementation == "sdpa"
|
| 488 |
+
and attention_mask is not None
|
| 489 |
+
and attention_mask.device.type == "cuda"
|
| 490 |
+
and not output_attentions
|
| 491 |
+
):
|
| 492 |
+
causal_mask = AttentionMaskConverter._unmask_unattended(causal_mask, min_dtype) # noqa
|
| 493 |
+
|
| 494 |
+
return causal_mask
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
class MonetForCausalLM(MonetPreTrainedModel):
|
| 498 |
+
_tied_weights_keys = ["lm_head.weight"]
|
| 499 |
+
|
| 500 |
+
def __init__(self, config):
|
| 501 |
+
super().__init__(config)
|
| 502 |
+
self.model = MonetModel(config)
|
| 503 |
+
self.vocab_size = config.vocab_size
|
| 504 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 505 |
+
|
| 506 |
+
# Initialize weights and apply final processing
|
| 507 |
+
self.post_init()
|
| 508 |
+
|
| 509 |
+
def get_input_embeddings(self):
|
| 510 |
+
return self.model.embed_tokens
|
| 511 |
+
|
| 512 |
+
def set_input_embeddings(self, value):
|
| 513 |
+
self.model.embed_tokens = value
|
| 514 |
+
|
| 515 |
+
def get_output_embeddings(self):
|
| 516 |
+
return self.lm_head
|
| 517 |
+
|
| 518 |
+
def set_output_embeddings(self, new_embeddings):
|
| 519 |
+
self.lm_head = new_embeddings
|
| 520 |
+
|
| 521 |
+
def set_decoder(self, decoder):
|
| 522 |
+
self.model = decoder
|
| 523 |
+
|
| 524 |
+
def get_decoder(self):
|
| 525 |
+
return self.model
|
| 526 |
+
|
| 527 |
+
def forward(
|
| 528 |
+
self,
|
| 529 |
+
input_ids: torch.LongTensor = None,
|
| 530 |
+
attention_mask: torch.Tensor | None = None,
|
| 531 |
+
position_ids: torch.LongTensor | None = None,
|
| 532 |
+
past_key_values: Cache | list[torch.FloatTensor] | None = None,
|
| 533 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 534 |
+
labels: torch.LongTensor | None = None,
|
| 535 |
+
use_cache: bool | None = None,
|
| 536 |
+
output_attentions: bool | None = None,
|
| 537 |
+
output_hidden_states: bool | None = None,
|
| 538 |
+
output_router_probs: bool | None = None,
|
| 539 |
+
return_dict: bool | None = None,
|
| 540 |
+
cache_position: torch.LongTensor | None = None,
|
| 541 |
+
) -> tuple[torch.Tensor, ...] | MonetCausalLMOutputWithPast:
|
| 542 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions # noqa
|
| 543 |
+
output_hidden_states = output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states # noqa
|
| 544 |
+
output_router_probs = output_router_probs if output_router_probs is not None else self.config.output_router_probs # noqa
|
| 545 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict # noqa
|
| 546 |
+
|
| 547 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
| 548 |
+
outputs = self.model(
|
| 549 |
+
input_ids=input_ids,
|
| 550 |
+
attention_mask=attention_mask,
|
| 551 |
+
position_ids=position_ids,
|
| 552 |
+
past_key_values=past_key_values,
|
| 553 |
+
inputs_embeds=inputs_embeds,
|
| 554 |
+
use_cache=use_cache,
|
| 555 |
+
output_attentions=output_attentions,
|
| 556 |
+
output_hidden_states=output_hidden_states,
|
| 557 |
+
output_router_probs=output_router_probs,
|
| 558 |
+
return_dict=return_dict,
|
| 559 |
+
cache_position=cache_position,
|
| 560 |
+
)
|
| 561 |
+
|
| 562 |
+
hidden_states = outputs[0]
|
| 563 |
+
logits = self.lm_head(hidden_states)
|
| 564 |
+
logits = logits.float()
|
| 565 |
+
|
| 566 |
+
loss = None
|
| 567 |
+
if labels is not None:
|
| 568 |
+
# Shift so that tokens < n predict n
|
| 569 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
| 570 |
+
shift_labels = labels[..., 1:].contiguous()
|
| 571 |
+
# Flatten the tokens
|
| 572 |
+
loss_fct = CrossEntropyLoss()
|
| 573 |
+
shift_logits = shift_logits.view(-1, self.config.vocab_size)
|
| 574 |
+
shift_labels = shift_labels.view(-1)
|
| 575 |
+
# Enable model parallelism
|
| 576 |
+
shift_labels = shift_labels.to(shift_logits.device)
|
| 577 |
+
loss = loss_fct(shift_logits, shift_labels)
|
| 578 |
+
|
| 579 |
+
if not return_dict:
|
| 580 |
+
output = (logits,) + outputs[1:]
|
| 581 |
+
return (loss,) + output if loss is not None else output
|
| 582 |
+
|
| 583 |
+
return MonetCausalLMOutputWithPast(
|
| 584 |
+
loss=loss,
|
| 585 |
+
logits=logits,
|
| 586 |
+
past_key_values=outputs.past_key_values,
|
| 587 |
+
hidden_states=outputs.hidden_states,
|
| 588 |
+
attentions=outputs.attentions,
|
| 589 |
+
router_probs=outputs.router_probs,
|
| 590 |
+
)
|
| 591 |
+
|
| 592 |
+
def prepare_inputs_for_generation(
|
| 593 |
+
self,
|
| 594 |
+
input_ids,
|
| 595 |
+
past_key_values=None,
|
| 596 |
+
attention_mask=None,
|
| 597 |
+
inputs_embeds=None,
|
| 598 |
+
cache_position=None,
|
| 599 |
+
use_cache=True,
|
| 600 |
+
**kwargs,
|
| 601 |
+
):
|
| 602 |
+
past_length = 0
|
| 603 |
+
if past_key_values is not None:
|
| 604 |
+
past_length = cache_position[0] if cache_position is not None else past_key_values.get_seq_length() # noqa
|
| 605 |
+
max_cache_length = (
|
| 606 |
+
torch.tensor(past_key_values.get_max_length(), device=input_ids.device)
|
| 607 |
+
if past_key_values.get_max_length() is not None
|
| 608 |
+
else None
|
| 609 |
+
)
|
| 610 |
+
cache_length = past_length if max_cache_length is None else torch.min(max_cache_length, past_length) # noqa
|
| 611 |
+
|
| 612 |
+
# Keep only the unprocessed tokens:
|
| 613 |
+
if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]: # noqa
|
| 614 |
+
input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
|
| 615 |
+
# input_ids based on the past_length.
|
| 616 |
+
elif past_length < input_ids.shape[1]:
|
| 617 |
+
input_ids = input_ids[:, past_length:]
|
| 618 |
+
|
| 619 |
+
if (
|
| 620 |
+
max_cache_length is not None
|
| 621 |
+
and attention_mask is not None
|
| 622 |
+
and cache_length + input_ids.shape[1] > max_cache_length
|
| 623 |
+
):
|
| 624 |
+
attention_mask = attention_mask[:, -max_cache_length:]
|
| 625 |
+
|
| 626 |
+
position_ids = kwargs.get("position_ids", None)
|
| 627 |
+
if attention_mask is not None and position_ids is None:
|
| 628 |
+
# create position_ids on the fly for batch generation
|
| 629 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 630 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 631 |
+
if past_key_values:
|
| 632 |
+
position_ids = position_ids[:, -input_ids.shape[1] :]
|
| 633 |
+
|
| 634 |
+
if inputs_embeds is not None and past_length == 0:
|
| 635 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
| 636 |
+
else:
|
| 637 |
+
model_inputs = {"input_ids": input_ids.contiguous()}
|
| 638 |
+
|
| 639 |
+
input_length = position_ids.shape[-1] if position_ids is not None else input_ids.shape[-1] # noqa
|
| 640 |
+
if cache_position is None:
|
| 641 |
+
cache_position = torch.arange(past_length, past_length + input_length, device=input_ids.device) # noqa
|
| 642 |
+
elif use_cache:
|
| 643 |
+
cache_position = cache_position[-input_length:]
|
| 644 |
+
|
| 645 |
+
model_inputs.update(
|
| 646 |
+
{
|
| 647 |
+
"position_ids": position_ids,
|
| 648 |
+
"cache_position": cache_position,
|
| 649 |
+
"past_key_values": past_key_values,
|
| 650 |
+
"use_cache": use_cache,
|
| 651 |
+
"attention_mask": attention_mask,
|
| 652 |
+
}
|
| 653 |
+
)
|
| 654 |
+
return model_inputs
|
| 655 |
+
|
| 656 |
+
@staticmethod
|
| 657 |
+
def _reorder_cache(past_key_values, beam_idx):
|
| 658 |
+
reordered_past = ()
|
| 659 |
+
for layer_past in past_key_values:
|
| 660 |
+
reordered_past += (
|
| 661 |
+
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past), # noqa
|
| 662 |
+
)
|
| 663 |
+
return reordered_past
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"unk_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
}
|
| 23 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": true,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"clean_up_tokenization_spaces": false,
|
| 33 |
+
"eos_token": "</s>",
|
| 34 |
+
"legacy": false,
|
| 35 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 36 |
+
"pad_token": null,
|
| 37 |
+
"padding_side": "right",
|
| 38 |
+
"sp_model_kwargs": {},
|
| 39 |
+
"spaces_between_special_tokens": false,
|
| 40 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 41 |
+
"unk_token": "<unk>",
|
| 42 |
+
"use_default_system_prompt": false
|
| 43 |
+
}
|