huseinzol05
commited on
Commit
•
9b786b8
1
Parent(s):
31196bd
Upload model
Browse files- config.json +21 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +538 -0
- modeling.py +260 -0
config.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "huseinzol05-dummy-mamba-1.4b/checkpoint-400",
|
3 |
+
"architectures": [
|
4 |
+
"MambaLMHeadModel"
|
5 |
+
],
|
6 |
+
"auto_map": {
|
7 |
+
"AutoModel": "modeling.MambaLMHeadModel"
|
8 |
+
},
|
9 |
+
"d_model": 2048,
|
10 |
+
"fused_add_norm": true,
|
11 |
+
"hidden_size": 2048,
|
12 |
+
"model_type": "mamba",
|
13 |
+
"n_layer": 48,
|
14 |
+
"pad_vocab_size_multiple": 8,
|
15 |
+
"residual_in_fp32": true,
|
16 |
+
"rms_norm": true,
|
17 |
+
"ssm_cfg": {},
|
18 |
+
"torch_dtype": "float32",
|
19 |
+
"transformers_version": "4.36.0.dev0",
|
20 |
+
"vocab_size": 32000
|
21 |
+
}
|
model-00001-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c2acae916870f1b5fc2b2a3ec2e8efb4a90b7d6c7c24ebd979a709f5e4ae0988
|
3 |
+
size 4988506824
|
model-00002-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a0f4988510bc7fca2780f682617c3422a6c19f0ae2e46c1ce2058e845703106a
|
3 |
+
size 350916592
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 5339365376
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"backbone.embedding.weight": "model-00001-of-00002.safetensors",
|
7 |
+
"backbone.layers.0.mixer.A_log": "model-00001-of-00002.safetensors",
|
8 |
+
"backbone.layers.0.mixer.D": "model-00001-of-00002.safetensors",
|
9 |
+
"backbone.layers.0.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
10 |
+
"backbone.layers.0.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
11 |
+
"backbone.layers.0.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
12 |
+
"backbone.layers.0.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
13 |
+
"backbone.layers.0.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
14 |
+
"backbone.layers.0.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
15 |
+
"backbone.layers.0.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
16 |
+
"backbone.layers.0.norm.bias": "model-00001-of-00002.safetensors",
|
17 |
+
"backbone.layers.0.norm.weight": "model-00001-of-00002.safetensors",
|
18 |
+
"backbone.layers.1.mixer.A_log": "model-00001-of-00002.safetensors",
|
19 |
+
"backbone.layers.1.mixer.D": "model-00001-of-00002.safetensors",
|
20 |
+
"backbone.layers.1.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
21 |
+
"backbone.layers.1.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
22 |
+
"backbone.layers.1.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
23 |
+
"backbone.layers.1.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
24 |
+
"backbone.layers.1.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
25 |
+
"backbone.layers.1.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
26 |
+
"backbone.layers.1.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
27 |
+
"backbone.layers.1.norm.bias": "model-00001-of-00002.safetensors",
|
28 |
+
"backbone.layers.1.norm.weight": "model-00001-of-00002.safetensors",
|
29 |
+
"backbone.layers.10.mixer.A_log": "model-00001-of-00002.safetensors",
|
30 |
+
"backbone.layers.10.mixer.D": "model-00001-of-00002.safetensors",
|
31 |
+
"backbone.layers.10.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
32 |
+
"backbone.layers.10.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
33 |
+
"backbone.layers.10.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
34 |
+
"backbone.layers.10.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
35 |
+
"backbone.layers.10.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
36 |
+
"backbone.layers.10.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
37 |
+
"backbone.layers.10.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
38 |
+
"backbone.layers.10.norm.bias": "model-00001-of-00002.safetensors",
|
39 |
+
"backbone.layers.10.norm.weight": "model-00001-of-00002.safetensors",
|
40 |
+
"backbone.layers.11.mixer.A_log": "model-00001-of-00002.safetensors",
|
41 |
+
"backbone.layers.11.mixer.D": "model-00001-of-00002.safetensors",
|
42 |
+
"backbone.layers.11.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
43 |
+
"backbone.layers.11.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
44 |
+
"backbone.layers.11.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
45 |
+
"backbone.layers.11.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
46 |
+
"backbone.layers.11.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
47 |
+
"backbone.layers.11.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
48 |
+
"backbone.layers.11.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
49 |
+
"backbone.layers.11.norm.bias": "model-00001-of-00002.safetensors",
|
50 |
+
"backbone.layers.11.norm.weight": "model-00001-of-00002.safetensors",
|
51 |
+
"backbone.layers.12.mixer.A_log": "model-00001-of-00002.safetensors",
|
52 |
+
"backbone.layers.12.mixer.D": "model-00001-of-00002.safetensors",
|
53 |
+
"backbone.layers.12.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
54 |
+
"backbone.layers.12.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
55 |
+
"backbone.layers.12.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
56 |
+
"backbone.layers.12.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
57 |
+
"backbone.layers.12.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
58 |
+
"backbone.layers.12.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
59 |
+
"backbone.layers.12.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
60 |
+
"backbone.layers.12.norm.bias": "model-00001-of-00002.safetensors",
|
61 |
+
"backbone.layers.12.norm.weight": "model-00001-of-00002.safetensors",
|
62 |
+
"backbone.layers.13.mixer.A_log": "model-00001-of-00002.safetensors",
|
63 |
+
"backbone.layers.13.mixer.D": "model-00001-of-00002.safetensors",
|
64 |
+
"backbone.layers.13.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
65 |
+
"backbone.layers.13.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
66 |
+
"backbone.layers.13.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
67 |
+
"backbone.layers.13.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
68 |
+
"backbone.layers.13.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
69 |
+
"backbone.layers.13.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
70 |
+
"backbone.layers.13.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
71 |
+
"backbone.layers.13.norm.bias": "model-00001-of-00002.safetensors",
|
72 |
+
"backbone.layers.13.norm.weight": "model-00001-of-00002.safetensors",
|
73 |
+
"backbone.layers.14.mixer.A_log": "model-00001-of-00002.safetensors",
|
74 |
+
"backbone.layers.14.mixer.D": "model-00001-of-00002.safetensors",
|
75 |
+
"backbone.layers.14.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
76 |
+
"backbone.layers.14.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
77 |
+
"backbone.layers.14.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
78 |
+
"backbone.layers.14.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
79 |
+
"backbone.layers.14.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
80 |
+
"backbone.layers.14.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
81 |
+
"backbone.layers.14.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
82 |
+
"backbone.layers.14.norm.bias": "model-00001-of-00002.safetensors",
|
83 |
+
"backbone.layers.14.norm.weight": "model-00001-of-00002.safetensors",
|
84 |
+
"backbone.layers.15.mixer.A_log": "model-00001-of-00002.safetensors",
|
85 |
+
"backbone.layers.15.mixer.D": "model-00001-of-00002.safetensors",
|
86 |
+
"backbone.layers.15.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
87 |
+
"backbone.layers.15.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
88 |
+
"backbone.layers.15.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
89 |
+
"backbone.layers.15.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
90 |
+
"backbone.layers.15.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
91 |
+
"backbone.layers.15.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
92 |
+
"backbone.layers.15.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
93 |
+
"backbone.layers.15.norm.bias": "model-00001-of-00002.safetensors",
|
94 |
+
"backbone.layers.15.norm.weight": "model-00001-of-00002.safetensors",
|
95 |
+
"backbone.layers.16.mixer.A_log": "model-00001-of-00002.safetensors",
|
96 |
+
"backbone.layers.16.mixer.D": "model-00001-of-00002.safetensors",
|
97 |
+
"backbone.layers.16.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
98 |
+
"backbone.layers.16.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
99 |
+
"backbone.layers.16.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
100 |
+
"backbone.layers.16.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
101 |
+
"backbone.layers.16.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
102 |
+
"backbone.layers.16.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
103 |
+
"backbone.layers.16.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
104 |
+
"backbone.layers.16.norm.bias": "model-00001-of-00002.safetensors",
|
105 |
+
"backbone.layers.16.norm.weight": "model-00001-of-00002.safetensors",
|
106 |
+
"backbone.layers.17.mixer.A_log": "model-00001-of-00002.safetensors",
|
107 |
+
"backbone.layers.17.mixer.D": "model-00001-of-00002.safetensors",
|
108 |
+
"backbone.layers.17.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
109 |
+
"backbone.layers.17.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
110 |
+
"backbone.layers.17.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
111 |
+
"backbone.layers.17.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
112 |
+
"backbone.layers.17.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
113 |
+
"backbone.layers.17.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
114 |
+
"backbone.layers.17.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
115 |
+
"backbone.layers.17.norm.bias": "model-00001-of-00002.safetensors",
|
116 |
+
"backbone.layers.17.norm.weight": "model-00001-of-00002.safetensors",
|
117 |
+
"backbone.layers.18.mixer.A_log": "model-00001-of-00002.safetensors",
|
118 |
+
"backbone.layers.18.mixer.D": "model-00001-of-00002.safetensors",
|
119 |
+
"backbone.layers.18.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
120 |
+
"backbone.layers.18.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
121 |
+
"backbone.layers.18.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
122 |
+
"backbone.layers.18.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
123 |
+
"backbone.layers.18.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
124 |
+
"backbone.layers.18.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
125 |
+
"backbone.layers.18.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
126 |
+
"backbone.layers.18.norm.bias": "model-00001-of-00002.safetensors",
|
127 |
+
"backbone.layers.18.norm.weight": "model-00001-of-00002.safetensors",
|
128 |
+
"backbone.layers.19.mixer.A_log": "model-00001-of-00002.safetensors",
|
129 |
+
"backbone.layers.19.mixer.D": "model-00001-of-00002.safetensors",
|
130 |
+
"backbone.layers.19.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
131 |
+
"backbone.layers.19.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
132 |
+
"backbone.layers.19.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
133 |
+
"backbone.layers.19.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
134 |
+
"backbone.layers.19.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
135 |
+
"backbone.layers.19.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
136 |
+
"backbone.layers.19.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
137 |
+
"backbone.layers.19.norm.bias": "model-00001-of-00002.safetensors",
|
138 |
+
"backbone.layers.19.norm.weight": "model-00001-of-00002.safetensors",
|
139 |
+
"backbone.layers.2.mixer.A_log": "model-00001-of-00002.safetensors",
|
140 |
+
"backbone.layers.2.mixer.D": "model-00001-of-00002.safetensors",
|
141 |
+
"backbone.layers.2.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
142 |
+
"backbone.layers.2.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
143 |
+
"backbone.layers.2.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
144 |
+
"backbone.layers.2.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
145 |
+
"backbone.layers.2.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
146 |
+
"backbone.layers.2.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
147 |
+
"backbone.layers.2.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
148 |
+
"backbone.layers.2.norm.bias": "model-00001-of-00002.safetensors",
|
149 |
+
"backbone.layers.2.norm.weight": "model-00001-of-00002.safetensors",
|
150 |
+
"backbone.layers.20.mixer.A_log": "model-00001-of-00002.safetensors",
|
151 |
+
"backbone.layers.20.mixer.D": "model-00001-of-00002.safetensors",
|
152 |
+
"backbone.layers.20.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
153 |
+
"backbone.layers.20.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
154 |
+
"backbone.layers.20.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
155 |
+
"backbone.layers.20.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
156 |
+
"backbone.layers.20.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
157 |
+
"backbone.layers.20.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
158 |
+
"backbone.layers.20.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
159 |
+
"backbone.layers.20.norm.bias": "model-00001-of-00002.safetensors",
|
160 |
+
"backbone.layers.20.norm.weight": "model-00001-of-00002.safetensors",
|
161 |
+
"backbone.layers.21.mixer.A_log": "model-00001-of-00002.safetensors",
|
162 |
+
"backbone.layers.21.mixer.D": "model-00001-of-00002.safetensors",
|
163 |
+
"backbone.layers.21.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
164 |
+
"backbone.layers.21.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
165 |
+
"backbone.layers.21.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
166 |
+
"backbone.layers.21.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
167 |
+
"backbone.layers.21.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
168 |
+
"backbone.layers.21.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
169 |
+
"backbone.layers.21.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
170 |
+
"backbone.layers.21.norm.bias": "model-00001-of-00002.safetensors",
|
171 |
+
"backbone.layers.21.norm.weight": "model-00001-of-00002.safetensors",
|
172 |
+
"backbone.layers.22.mixer.A_log": "model-00001-of-00002.safetensors",
|
173 |
+
"backbone.layers.22.mixer.D": "model-00001-of-00002.safetensors",
|
174 |
+
"backbone.layers.22.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
175 |
+
"backbone.layers.22.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
176 |
+
"backbone.layers.22.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
177 |
+
"backbone.layers.22.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
178 |
+
"backbone.layers.22.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
179 |
+
"backbone.layers.22.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
180 |
+
"backbone.layers.22.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
181 |
+
"backbone.layers.22.norm.bias": "model-00001-of-00002.safetensors",
|
182 |
+
"backbone.layers.22.norm.weight": "model-00001-of-00002.safetensors",
|
183 |
+
"backbone.layers.23.mixer.A_log": "model-00001-of-00002.safetensors",
|
184 |
+
"backbone.layers.23.mixer.D": "model-00001-of-00002.safetensors",
|
185 |
+
"backbone.layers.23.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
186 |
+
"backbone.layers.23.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
187 |
+
"backbone.layers.23.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
188 |
+
"backbone.layers.23.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
189 |
+
"backbone.layers.23.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
190 |
+
"backbone.layers.23.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
191 |
+
"backbone.layers.23.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
192 |
+
"backbone.layers.23.norm.bias": "model-00001-of-00002.safetensors",
|
193 |
+
"backbone.layers.23.norm.weight": "model-00001-of-00002.safetensors",
|
194 |
+
"backbone.layers.24.mixer.A_log": "model-00001-of-00002.safetensors",
|
195 |
+
"backbone.layers.24.mixer.D": "model-00001-of-00002.safetensors",
|
196 |
+
"backbone.layers.24.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
197 |
+
"backbone.layers.24.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
198 |
+
"backbone.layers.24.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
199 |
+
"backbone.layers.24.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
200 |
+
"backbone.layers.24.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
201 |
+
"backbone.layers.24.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
202 |
+
"backbone.layers.24.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
203 |
+
"backbone.layers.24.norm.bias": "model-00001-of-00002.safetensors",
|
204 |
+
"backbone.layers.24.norm.weight": "model-00001-of-00002.safetensors",
|
205 |
+
"backbone.layers.25.mixer.A_log": "model-00001-of-00002.safetensors",
|
206 |
+
"backbone.layers.25.mixer.D": "model-00001-of-00002.safetensors",
|
207 |
+
"backbone.layers.25.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
208 |
+
"backbone.layers.25.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
209 |
+
"backbone.layers.25.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
210 |
+
"backbone.layers.25.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
211 |
+
"backbone.layers.25.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
212 |
+
"backbone.layers.25.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
213 |
+
"backbone.layers.25.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
214 |
+
"backbone.layers.25.norm.bias": "model-00001-of-00002.safetensors",
|
215 |
+
"backbone.layers.25.norm.weight": "model-00001-of-00002.safetensors",
|
216 |
+
"backbone.layers.26.mixer.A_log": "model-00001-of-00002.safetensors",
|
217 |
+
"backbone.layers.26.mixer.D": "model-00001-of-00002.safetensors",
|
218 |
+
"backbone.layers.26.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
219 |
+
"backbone.layers.26.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
220 |
+
"backbone.layers.26.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
221 |
+
"backbone.layers.26.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
222 |
+
"backbone.layers.26.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
223 |
+
"backbone.layers.26.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
224 |
+
"backbone.layers.26.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
225 |
+
"backbone.layers.26.norm.bias": "model-00001-of-00002.safetensors",
|
226 |
+
"backbone.layers.26.norm.weight": "model-00001-of-00002.safetensors",
|
227 |
+
"backbone.layers.27.mixer.A_log": "model-00001-of-00002.safetensors",
|
228 |
+
"backbone.layers.27.mixer.D": "model-00001-of-00002.safetensors",
|
229 |
+
"backbone.layers.27.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
230 |
+
"backbone.layers.27.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
231 |
+
"backbone.layers.27.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
232 |
+
"backbone.layers.27.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
233 |
+
"backbone.layers.27.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
234 |
+
"backbone.layers.27.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
235 |
+
"backbone.layers.27.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
236 |
+
"backbone.layers.27.norm.bias": "model-00001-of-00002.safetensors",
|
237 |
+
"backbone.layers.27.norm.weight": "model-00001-of-00002.safetensors",
|
238 |
+
"backbone.layers.28.mixer.A_log": "model-00001-of-00002.safetensors",
|
239 |
+
"backbone.layers.28.mixer.D": "model-00001-of-00002.safetensors",
|
240 |
+
"backbone.layers.28.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
241 |
+
"backbone.layers.28.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
242 |
+
"backbone.layers.28.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
243 |
+
"backbone.layers.28.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
244 |
+
"backbone.layers.28.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
245 |
+
"backbone.layers.28.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
246 |
+
"backbone.layers.28.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
247 |
+
"backbone.layers.28.norm.bias": "model-00001-of-00002.safetensors",
|
248 |
+
"backbone.layers.28.norm.weight": "model-00001-of-00002.safetensors",
|
249 |
+
"backbone.layers.29.mixer.A_log": "model-00001-of-00002.safetensors",
|
250 |
+
"backbone.layers.29.mixer.D": "model-00001-of-00002.safetensors",
|
251 |
+
"backbone.layers.29.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
252 |
+
"backbone.layers.29.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
253 |
+
"backbone.layers.29.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
254 |
+
"backbone.layers.29.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
255 |
+
"backbone.layers.29.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
256 |
+
"backbone.layers.29.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
257 |
+
"backbone.layers.29.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
258 |
+
"backbone.layers.29.norm.bias": "model-00001-of-00002.safetensors",
|
259 |
+
"backbone.layers.29.norm.weight": "model-00001-of-00002.safetensors",
|
260 |
+
"backbone.layers.3.mixer.A_log": "model-00001-of-00002.safetensors",
|
261 |
+
"backbone.layers.3.mixer.D": "model-00001-of-00002.safetensors",
|
262 |
+
"backbone.layers.3.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
263 |
+
"backbone.layers.3.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
264 |
+
"backbone.layers.3.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
265 |
+
"backbone.layers.3.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
266 |
+
"backbone.layers.3.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
267 |
+
"backbone.layers.3.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
268 |
+
"backbone.layers.3.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
269 |
+
"backbone.layers.3.norm.bias": "model-00001-of-00002.safetensors",
|
270 |
+
"backbone.layers.3.norm.weight": "model-00001-of-00002.safetensors",
|
271 |
+
"backbone.layers.30.mixer.A_log": "model-00001-of-00002.safetensors",
|
272 |
+
"backbone.layers.30.mixer.D": "model-00001-of-00002.safetensors",
|
273 |
+
"backbone.layers.30.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
274 |
+
"backbone.layers.30.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
275 |
+
"backbone.layers.30.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
276 |
+
"backbone.layers.30.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
277 |
+
"backbone.layers.30.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
278 |
+
"backbone.layers.30.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
279 |
+
"backbone.layers.30.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
280 |
+
"backbone.layers.30.norm.bias": "model-00001-of-00002.safetensors",
|
281 |
+
"backbone.layers.30.norm.weight": "model-00001-of-00002.safetensors",
|
282 |
+
"backbone.layers.31.mixer.A_log": "model-00001-of-00002.safetensors",
|
283 |
+
"backbone.layers.31.mixer.D": "model-00001-of-00002.safetensors",
|
284 |
+
"backbone.layers.31.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
285 |
+
"backbone.layers.31.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
286 |
+
"backbone.layers.31.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
287 |
+
"backbone.layers.31.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
288 |
+
"backbone.layers.31.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
289 |
+
"backbone.layers.31.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
290 |
+
"backbone.layers.31.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
291 |
+
"backbone.layers.31.norm.bias": "model-00001-of-00002.safetensors",
|
292 |
+
"backbone.layers.31.norm.weight": "model-00001-of-00002.safetensors",
|
293 |
+
"backbone.layers.32.mixer.A_log": "model-00001-of-00002.safetensors",
|
294 |
+
"backbone.layers.32.mixer.D": "model-00001-of-00002.safetensors",
|
295 |
+
"backbone.layers.32.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
296 |
+
"backbone.layers.32.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
297 |
+
"backbone.layers.32.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
298 |
+
"backbone.layers.32.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
299 |
+
"backbone.layers.32.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
300 |
+
"backbone.layers.32.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
301 |
+
"backbone.layers.32.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
302 |
+
"backbone.layers.32.norm.bias": "model-00001-of-00002.safetensors",
|
303 |
+
"backbone.layers.32.norm.weight": "model-00001-of-00002.safetensors",
|
304 |
+
"backbone.layers.33.mixer.A_log": "model-00001-of-00002.safetensors",
|
305 |
+
"backbone.layers.33.mixer.D": "model-00001-of-00002.safetensors",
|
306 |
+
"backbone.layers.33.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
307 |
+
"backbone.layers.33.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
308 |
+
"backbone.layers.33.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
309 |
+
"backbone.layers.33.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
310 |
+
"backbone.layers.33.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
311 |
+
"backbone.layers.33.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
312 |
+
"backbone.layers.33.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
313 |
+
"backbone.layers.33.norm.bias": "model-00001-of-00002.safetensors",
|
314 |
+
"backbone.layers.33.norm.weight": "model-00001-of-00002.safetensors",
|
315 |
+
"backbone.layers.34.mixer.A_log": "model-00001-of-00002.safetensors",
|
316 |
+
"backbone.layers.34.mixer.D": "model-00001-of-00002.safetensors",
|
317 |
+
"backbone.layers.34.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
318 |
+
"backbone.layers.34.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
319 |
+
"backbone.layers.34.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
320 |
+
"backbone.layers.34.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
321 |
+
"backbone.layers.34.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
322 |
+
"backbone.layers.34.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
323 |
+
"backbone.layers.34.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
324 |
+
"backbone.layers.34.norm.bias": "model-00001-of-00002.safetensors",
|
325 |
+
"backbone.layers.34.norm.weight": "model-00001-of-00002.safetensors",
|
326 |
+
"backbone.layers.35.mixer.A_log": "model-00001-of-00002.safetensors",
|
327 |
+
"backbone.layers.35.mixer.D": "model-00001-of-00002.safetensors",
|
328 |
+
"backbone.layers.35.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
329 |
+
"backbone.layers.35.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
330 |
+
"backbone.layers.35.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
331 |
+
"backbone.layers.35.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
332 |
+
"backbone.layers.35.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
333 |
+
"backbone.layers.35.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
334 |
+
"backbone.layers.35.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
335 |
+
"backbone.layers.35.norm.bias": "model-00001-of-00002.safetensors",
|
336 |
+
"backbone.layers.35.norm.weight": "model-00001-of-00002.safetensors",
|
337 |
+
"backbone.layers.36.mixer.A_log": "model-00001-of-00002.safetensors",
|
338 |
+
"backbone.layers.36.mixer.D": "model-00001-of-00002.safetensors",
|
339 |
+
"backbone.layers.36.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
340 |
+
"backbone.layers.36.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
341 |
+
"backbone.layers.36.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
342 |
+
"backbone.layers.36.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
343 |
+
"backbone.layers.36.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
344 |
+
"backbone.layers.36.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
345 |
+
"backbone.layers.36.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
346 |
+
"backbone.layers.36.norm.bias": "model-00001-of-00002.safetensors",
|
347 |
+
"backbone.layers.36.norm.weight": "model-00001-of-00002.safetensors",
|
348 |
+
"backbone.layers.37.mixer.A_log": "model-00001-of-00002.safetensors",
|
349 |
+
"backbone.layers.37.mixer.D": "model-00001-of-00002.safetensors",
|
350 |
+
"backbone.layers.37.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
351 |
+
"backbone.layers.37.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
352 |
+
"backbone.layers.37.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
353 |
+
"backbone.layers.37.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
354 |
+
"backbone.layers.37.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
355 |
+
"backbone.layers.37.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
356 |
+
"backbone.layers.37.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
357 |
+
"backbone.layers.37.norm.bias": "model-00001-of-00002.safetensors",
|
358 |
+
"backbone.layers.37.norm.weight": "model-00001-of-00002.safetensors",
|
359 |
+
"backbone.layers.38.mixer.A_log": "model-00001-of-00002.safetensors",
|
360 |
+
"backbone.layers.38.mixer.D": "model-00001-of-00002.safetensors",
|
361 |
+
"backbone.layers.38.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
362 |
+
"backbone.layers.38.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
363 |
+
"backbone.layers.38.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
364 |
+
"backbone.layers.38.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
365 |
+
"backbone.layers.38.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
366 |
+
"backbone.layers.38.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
367 |
+
"backbone.layers.38.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
368 |
+
"backbone.layers.38.norm.bias": "model-00001-of-00002.safetensors",
|
369 |
+
"backbone.layers.38.norm.weight": "model-00001-of-00002.safetensors",
|
370 |
+
"backbone.layers.39.mixer.A_log": "model-00001-of-00002.safetensors",
|
371 |
+
"backbone.layers.39.mixer.D": "model-00001-of-00002.safetensors",
|
372 |
+
"backbone.layers.39.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
373 |
+
"backbone.layers.39.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
374 |
+
"backbone.layers.39.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
375 |
+
"backbone.layers.39.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
376 |
+
"backbone.layers.39.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
377 |
+
"backbone.layers.39.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
378 |
+
"backbone.layers.39.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
379 |
+
"backbone.layers.39.norm.bias": "model-00001-of-00002.safetensors",
|
380 |
+
"backbone.layers.39.norm.weight": "model-00001-of-00002.safetensors",
|
381 |
+
"backbone.layers.4.mixer.A_log": "model-00001-of-00002.safetensors",
|
382 |
+
"backbone.layers.4.mixer.D": "model-00001-of-00002.safetensors",
|
383 |
+
"backbone.layers.4.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
384 |
+
"backbone.layers.4.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
385 |
+
"backbone.layers.4.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
386 |
+
"backbone.layers.4.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
387 |
+
"backbone.layers.4.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
388 |
+
"backbone.layers.4.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
389 |
+
"backbone.layers.4.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
390 |
+
"backbone.layers.4.norm.bias": "model-00001-of-00002.safetensors",
|
391 |
+
"backbone.layers.4.norm.weight": "model-00001-of-00002.safetensors",
|
392 |
+
"backbone.layers.40.mixer.A_log": "model-00001-of-00002.safetensors",
|
393 |
+
"backbone.layers.40.mixer.D": "model-00001-of-00002.safetensors",
|
394 |
+
"backbone.layers.40.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
395 |
+
"backbone.layers.40.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
396 |
+
"backbone.layers.40.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
397 |
+
"backbone.layers.40.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
398 |
+
"backbone.layers.40.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
399 |
+
"backbone.layers.40.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
400 |
+
"backbone.layers.40.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
401 |
+
"backbone.layers.40.norm.bias": "model-00001-of-00002.safetensors",
|
402 |
+
"backbone.layers.40.norm.weight": "model-00001-of-00002.safetensors",
|
403 |
+
"backbone.layers.41.mixer.A_log": "model-00001-of-00002.safetensors",
|
404 |
+
"backbone.layers.41.mixer.D": "model-00001-of-00002.safetensors",
|
405 |
+
"backbone.layers.41.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
406 |
+
"backbone.layers.41.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
407 |
+
"backbone.layers.41.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
408 |
+
"backbone.layers.41.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
409 |
+
"backbone.layers.41.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
410 |
+
"backbone.layers.41.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
411 |
+
"backbone.layers.41.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
412 |
+
"backbone.layers.41.norm.bias": "model-00001-of-00002.safetensors",
|
413 |
+
"backbone.layers.41.norm.weight": "model-00001-of-00002.safetensors",
|
414 |
+
"backbone.layers.42.mixer.A_log": "model-00001-of-00002.safetensors",
|
415 |
+
"backbone.layers.42.mixer.D": "model-00001-of-00002.safetensors",
|
416 |
+
"backbone.layers.42.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
417 |
+
"backbone.layers.42.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
418 |
+
"backbone.layers.42.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
419 |
+
"backbone.layers.42.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
420 |
+
"backbone.layers.42.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
421 |
+
"backbone.layers.42.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
422 |
+
"backbone.layers.42.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
423 |
+
"backbone.layers.42.norm.bias": "model-00001-of-00002.safetensors",
|
424 |
+
"backbone.layers.42.norm.weight": "model-00001-of-00002.safetensors",
|
425 |
+
"backbone.layers.43.mixer.A_log": "model-00001-of-00002.safetensors",
|
426 |
+
"backbone.layers.43.mixer.D": "model-00001-of-00002.safetensors",
|
427 |
+
"backbone.layers.43.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
428 |
+
"backbone.layers.43.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
429 |
+
"backbone.layers.43.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
430 |
+
"backbone.layers.43.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
431 |
+
"backbone.layers.43.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
432 |
+
"backbone.layers.43.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
433 |
+
"backbone.layers.43.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
434 |
+
"backbone.layers.43.norm.bias": "model-00001-of-00002.safetensors",
|
435 |
+
"backbone.layers.43.norm.weight": "model-00001-of-00002.safetensors",
|
436 |
+
"backbone.layers.44.mixer.A_log": "model-00001-of-00002.safetensors",
|
437 |
+
"backbone.layers.44.mixer.D": "model-00001-of-00002.safetensors",
|
438 |
+
"backbone.layers.44.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
439 |
+
"backbone.layers.44.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
440 |
+
"backbone.layers.44.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
441 |
+
"backbone.layers.44.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
442 |
+
"backbone.layers.44.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
443 |
+
"backbone.layers.44.mixer.out_proj.weight": "model-00002-of-00002.safetensors",
|
444 |
+
"backbone.layers.44.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
445 |
+
"backbone.layers.44.norm.bias": "model-00002-of-00002.safetensors",
|
446 |
+
"backbone.layers.44.norm.weight": "model-00002-of-00002.safetensors",
|
447 |
+
"backbone.layers.45.mixer.A_log": "model-00002-of-00002.safetensors",
|
448 |
+
"backbone.layers.45.mixer.D": "model-00002-of-00002.safetensors",
|
449 |
+
"backbone.layers.45.mixer.conv1d.bias": "model-00002-of-00002.safetensors",
|
450 |
+
"backbone.layers.45.mixer.conv1d.weight": "model-00002-of-00002.safetensors",
|
451 |
+
"backbone.layers.45.mixer.dt_proj.bias": "model-00002-of-00002.safetensors",
|
452 |
+
"backbone.layers.45.mixer.dt_proj.weight": "model-00002-of-00002.safetensors",
|
453 |
+
"backbone.layers.45.mixer.in_proj.weight": "model-00002-of-00002.safetensors",
|
454 |
+
"backbone.layers.45.mixer.out_proj.weight": "model-00002-of-00002.safetensors",
|
455 |
+
"backbone.layers.45.mixer.x_proj.weight": "model-00002-of-00002.safetensors",
|
456 |
+
"backbone.layers.45.norm.bias": "model-00002-of-00002.safetensors",
|
457 |
+
"backbone.layers.45.norm.weight": "model-00002-of-00002.safetensors",
|
458 |
+
"backbone.layers.46.mixer.A_log": "model-00002-of-00002.safetensors",
|
459 |
+
"backbone.layers.46.mixer.D": "model-00002-of-00002.safetensors",
|
460 |
+
"backbone.layers.46.mixer.conv1d.bias": "model-00002-of-00002.safetensors",
|
461 |
+
"backbone.layers.46.mixer.conv1d.weight": "model-00002-of-00002.safetensors",
|
462 |
+
"backbone.layers.46.mixer.dt_proj.bias": "model-00002-of-00002.safetensors",
|
463 |
+
"backbone.layers.46.mixer.dt_proj.weight": "model-00002-of-00002.safetensors",
|
464 |
+
"backbone.layers.46.mixer.in_proj.weight": "model-00002-of-00002.safetensors",
|
465 |
+
"backbone.layers.46.mixer.out_proj.weight": "model-00002-of-00002.safetensors",
|
466 |
+
"backbone.layers.46.mixer.x_proj.weight": "model-00002-of-00002.safetensors",
|
467 |
+
"backbone.layers.46.norm.bias": "model-00002-of-00002.safetensors",
|
468 |
+
"backbone.layers.46.norm.weight": "model-00002-of-00002.safetensors",
|
469 |
+
"backbone.layers.47.mixer.A_log": "model-00002-of-00002.safetensors",
|
470 |
+
"backbone.layers.47.mixer.D": "model-00002-of-00002.safetensors",
|
471 |
+
"backbone.layers.47.mixer.conv1d.bias": "model-00002-of-00002.safetensors",
|
472 |
+
"backbone.layers.47.mixer.conv1d.weight": "model-00002-of-00002.safetensors",
|
473 |
+
"backbone.layers.47.mixer.dt_proj.bias": "model-00002-of-00002.safetensors",
|
474 |
+
"backbone.layers.47.mixer.dt_proj.weight": "model-00002-of-00002.safetensors",
|
475 |
+
"backbone.layers.47.mixer.in_proj.weight": "model-00002-of-00002.safetensors",
|
476 |
+
"backbone.layers.47.mixer.out_proj.weight": "model-00002-of-00002.safetensors",
|
477 |
+
"backbone.layers.47.mixer.x_proj.weight": "model-00002-of-00002.safetensors",
|
478 |
+
"backbone.layers.47.norm.bias": "model-00002-of-00002.safetensors",
|
479 |
+
"backbone.layers.47.norm.weight": "model-00002-of-00002.safetensors",
|
480 |
+
"backbone.layers.5.mixer.A_log": "model-00001-of-00002.safetensors",
|
481 |
+
"backbone.layers.5.mixer.D": "model-00001-of-00002.safetensors",
|
482 |
+
"backbone.layers.5.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
483 |
+
"backbone.layers.5.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
484 |
+
"backbone.layers.5.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
485 |
+
"backbone.layers.5.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
486 |
+
"backbone.layers.5.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
487 |
+
"backbone.layers.5.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
488 |
+
"backbone.layers.5.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
489 |
+
"backbone.layers.5.norm.bias": "model-00001-of-00002.safetensors",
|
490 |
+
"backbone.layers.5.norm.weight": "model-00001-of-00002.safetensors",
|
491 |
+
"backbone.layers.6.mixer.A_log": "model-00001-of-00002.safetensors",
|
492 |
+
"backbone.layers.6.mixer.D": "model-00001-of-00002.safetensors",
|
493 |
+
"backbone.layers.6.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
494 |
+
"backbone.layers.6.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
495 |
+
"backbone.layers.6.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
496 |
+
"backbone.layers.6.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
497 |
+
"backbone.layers.6.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
498 |
+
"backbone.layers.6.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
499 |
+
"backbone.layers.6.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
500 |
+
"backbone.layers.6.norm.bias": "model-00001-of-00002.safetensors",
|
501 |
+
"backbone.layers.6.norm.weight": "model-00001-of-00002.safetensors",
|
502 |
+
"backbone.layers.7.mixer.A_log": "model-00001-of-00002.safetensors",
|
503 |
+
"backbone.layers.7.mixer.D": "model-00001-of-00002.safetensors",
|
504 |
+
"backbone.layers.7.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
505 |
+
"backbone.layers.7.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
506 |
+
"backbone.layers.7.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
507 |
+
"backbone.layers.7.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
508 |
+
"backbone.layers.7.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
509 |
+
"backbone.layers.7.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
510 |
+
"backbone.layers.7.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
511 |
+
"backbone.layers.7.norm.bias": "model-00001-of-00002.safetensors",
|
512 |
+
"backbone.layers.7.norm.weight": "model-00001-of-00002.safetensors",
|
513 |
+
"backbone.layers.8.mixer.A_log": "model-00001-of-00002.safetensors",
|
514 |
+
"backbone.layers.8.mixer.D": "model-00001-of-00002.safetensors",
|
515 |
+
"backbone.layers.8.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
516 |
+
"backbone.layers.8.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
517 |
+
"backbone.layers.8.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
518 |
+
"backbone.layers.8.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
519 |
+
"backbone.layers.8.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
520 |
+
"backbone.layers.8.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
521 |
+
"backbone.layers.8.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
522 |
+
"backbone.layers.8.norm.bias": "model-00001-of-00002.safetensors",
|
523 |
+
"backbone.layers.8.norm.weight": "model-00001-of-00002.safetensors",
|
524 |
+
"backbone.layers.9.mixer.A_log": "model-00001-of-00002.safetensors",
|
525 |
+
"backbone.layers.9.mixer.D": "model-00001-of-00002.safetensors",
|
526 |
+
"backbone.layers.9.mixer.conv1d.bias": "model-00001-of-00002.safetensors",
|
527 |
+
"backbone.layers.9.mixer.conv1d.weight": "model-00001-of-00002.safetensors",
|
528 |
+
"backbone.layers.9.mixer.dt_proj.bias": "model-00001-of-00002.safetensors",
|
529 |
+
"backbone.layers.9.mixer.dt_proj.weight": "model-00001-of-00002.safetensors",
|
530 |
+
"backbone.layers.9.mixer.in_proj.weight": "model-00001-of-00002.safetensors",
|
531 |
+
"backbone.layers.9.mixer.out_proj.weight": "model-00001-of-00002.safetensors",
|
532 |
+
"backbone.layers.9.mixer.x_proj.weight": "model-00001-of-00002.safetensors",
|
533 |
+
"backbone.layers.9.norm.bias": "model-00001-of-00002.safetensors",
|
534 |
+
"backbone.layers.9.norm.weight": "model-00001-of-00002.safetensors",
|
535 |
+
"backbone.norm_f.bias": "model-00002-of-00002.safetensors",
|
536 |
+
"backbone.norm_f.weight": "model-00002-of-00002.safetensors"
|
537 |
+
}
|
538 |
+
}
|
modeling.py
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) 2023, Albert Gu, Tri Dao.
|
2 |
+
|
3 |
+
import math
|
4 |
+
from functools import partial
|
5 |
+
|
6 |
+
from collections import namedtuple
|
7 |
+
|
8 |
+
import torch
|
9 |
+
import torch.nn as nn
|
10 |
+
from torch.nn import CrossEntropyLoss
|
11 |
+
from transformers import PretrainedConfig, PreTrainedModel
|
12 |
+
|
13 |
+
from mamba_ssm.modules.mamba_simple import Mamba, Block
|
14 |
+
from mamba_ssm.utils.generation import GenerationMixin
|
15 |
+
from mamba_ssm.utils.hf import load_config_hf, load_state_dict_hf
|
16 |
+
|
17 |
+
try:
|
18 |
+
from mamba_ssm.ops.triton.layernorm import RMSNorm, layer_norm_fn, rms_norm_fn
|
19 |
+
except ImportError:
|
20 |
+
RMSNorm, layer_norm_fn, rms_norm_fn = None, None, None
|
21 |
+
|
22 |
+
|
23 |
+
class MambaConfig(PretrainedConfig):
|
24 |
+
model_type = 'mamba'
|
25 |
+
|
26 |
+
|
27 |
+
def create_block(
|
28 |
+
d_model,
|
29 |
+
ssm_cfg=None,
|
30 |
+
norm_epsilon=1e-5,
|
31 |
+
rms_norm=False,
|
32 |
+
residual_in_fp32=False,
|
33 |
+
fused_add_norm=False,
|
34 |
+
layer_idx=None,
|
35 |
+
device=None,
|
36 |
+
dtype=None,
|
37 |
+
):
|
38 |
+
if ssm_cfg is None:
|
39 |
+
ssm_cfg = {}
|
40 |
+
factory_kwargs = {"device": device, "dtype": dtype}
|
41 |
+
mixer_cls = partial(Mamba, layer_idx=layer_idx, **ssm_cfg, **factory_kwargs)
|
42 |
+
norm_cls = partial(
|
43 |
+
nn.LayerNorm if not rms_norm else RMSNorm, eps=norm_epsilon, **factory_kwargs
|
44 |
+
)
|
45 |
+
block = Block(
|
46 |
+
d_model,
|
47 |
+
mixer_cls,
|
48 |
+
norm_cls=norm_cls,
|
49 |
+
fused_add_norm=fused_add_norm,
|
50 |
+
residual_in_fp32=residual_in_fp32,
|
51 |
+
)
|
52 |
+
block.layer_idx = layer_idx
|
53 |
+
return block
|
54 |
+
|
55 |
+
|
56 |
+
# https://github.com/huggingface/transformers/blob/c28d04e9e252a1a099944e325685f14d242ecdcd/src/transformers/models/gpt2/modeling_gpt2.py#L454
|
57 |
+
def _init_weights(
|
58 |
+
module,
|
59 |
+
n_layer,
|
60 |
+
initializer_range=0.02, # Now only used for embedding layer.
|
61 |
+
rescale_prenorm_residual=True,
|
62 |
+
n_residuals_per_layer=1, # Change to 2 if we have MLP
|
63 |
+
):
|
64 |
+
if isinstance(module, nn.Linear):
|
65 |
+
if module.bias is not None:
|
66 |
+
if not getattr(module.bias, "_no_reinit", False):
|
67 |
+
nn.init.zeros_(module.bias)
|
68 |
+
elif isinstance(module, nn.Embedding):
|
69 |
+
nn.init.normal_(module.weight, std=initializer_range)
|
70 |
+
|
71 |
+
if rescale_prenorm_residual:
|
72 |
+
# Reinitialize selected weights subject to the OpenAI GPT-2 Paper Scheme:
|
73 |
+
# > A modified initialization which accounts for the accumulation on the residual path with model depth. Scale
|
74 |
+
# > the weights of residual layers at initialization by a factor of 1/√N where N is the # of residual layers.
|
75 |
+
# > -- GPT-2 :: https://openai.com/blog/better-language-models/
|
76 |
+
#
|
77 |
+
# Reference (Megatron-LM):
|
78 |
+
# https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/model/gpt_model.py
|
79 |
+
for name, p in module.named_parameters():
|
80 |
+
if name in ["out_proj.weight", "fc2.weight"]:
|
81 |
+
# Special Scaled Initialization --> There are 2 Layer Norms per Transformer Block
|
82 |
+
# Following Pytorch init, except scale by 1/sqrt(2 * n_layer)
|
83 |
+
# We need to reinit p since this code could be called multiple times
|
84 |
+
# Having just p *= scale would repeatedly scale it down
|
85 |
+
nn.init.kaiming_uniform_(p, a=math.sqrt(5))
|
86 |
+
with torch.no_grad():
|
87 |
+
p /= math.sqrt(n_residuals_per_layer * n_layer)
|
88 |
+
|
89 |
+
|
90 |
+
class MixerModel(nn.Module):
|
91 |
+
def __init__(
|
92 |
+
self,
|
93 |
+
d_model: int,
|
94 |
+
n_layer: int,
|
95 |
+
vocab_size: int,
|
96 |
+
ssm_cfg=None,
|
97 |
+
norm_epsilon: float = 1e-5,
|
98 |
+
rms_norm: bool = False,
|
99 |
+
initializer_cfg=None,
|
100 |
+
fused_add_norm=False,
|
101 |
+
residual_in_fp32=False,
|
102 |
+
device=None,
|
103 |
+
dtype=None,
|
104 |
+
) -> None:
|
105 |
+
factory_kwargs = {"device": device, "dtype": dtype}
|
106 |
+
super().__init__()
|
107 |
+
self.residual_in_fp32 = residual_in_fp32
|
108 |
+
|
109 |
+
self.embedding = nn.Embedding(vocab_size, d_model, **factory_kwargs)
|
110 |
+
|
111 |
+
# We change the order of residual and layer norm:
|
112 |
+
# Instead of LN -> Attn / MLP -> Add, we do:
|
113 |
+
# Add -> LN -> Attn / MLP / Mixer, returning both the residual branch (output of Add) and
|
114 |
+
# the main branch (output of MLP / Mixer). The model definition is unchanged.
|
115 |
+
# This is for performance reason: we can fuse add + layer_norm.
|
116 |
+
self.fused_add_norm = fused_add_norm
|
117 |
+
if self.fused_add_norm:
|
118 |
+
if layer_norm_fn is None or rms_norm_fn is None:
|
119 |
+
raise ImportError("Failed to import Triton LayerNorm / RMSNorm kernels")
|
120 |
+
|
121 |
+
self.layers = nn.ModuleList(
|
122 |
+
[
|
123 |
+
create_block(
|
124 |
+
d_model,
|
125 |
+
ssm_cfg=ssm_cfg,
|
126 |
+
norm_epsilon=norm_epsilon,
|
127 |
+
rms_norm=rms_norm,
|
128 |
+
residual_in_fp32=residual_in_fp32,
|
129 |
+
fused_add_norm=fused_add_norm,
|
130 |
+
layer_idx=i,
|
131 |
+
**factory_kwargs,
|
132 |
+
)
|
133 |
+
for i in range(n_layer)
|
134 |
+
]
|
135 |
+
)
|
136 |
+
|
137 |
+
self.norm_f = (nn.LayerNorm if not rms_norm else RMSNorm)(
|
138 |
+
d_model, eps=norm_epsilon, **factory_kwargs
|
139 |
+
)
|
140 |
+
|
141 |
+
self.apply(
|
142 |
+
partial(
|
143 |
+
_init_weights,
|
144 |
+
n_layer=n_layer,
|
145 |
+
**(initializer_cfg if initializer_cfg is not None else {}),
|
146 |
+
)
|
147 |
+
)
|
148 |
+
|
149 |
+
def allocate_inference_cache(self, batch_size, max_seqlen, dtype=None, **kwargs):
|
150 |
+
return {
|
151 |
+
i: layer.allocate_inference_cache(batch_size, max_seqlen, dtype=dtype, **kwargs)
|
152 |
+
for i, layer in enumerate(self.layers)
|
153 |
+
}
|
154 |
+
|
155 |
+
def forward(self, input_ids, inference_params=None):
|
156 |
+
hidden_states = self.embedding(input_ids)
|
157 |
+
residual = None
|
158 |
+
for layer in self.layers:
|
159 |
+
hidden_states, residual = layer(
|
160 |
+
hidden_states, residual, inference_params=inference_params
|
161 |
+
)
|
162 |
+
if not self.fused_add_norm:
|
163 |
+
residual = (hidden_states + residual) if residual is not None else hidden_states
|
164 |
+
hidden_states = self.norm_f(residual.to(dtype=self.norm_f.weight.dtype))
|
165 |
+
else:
|
166 |
+
# Set prenorm=False here since we don't need the residual
|
167 |
+
fused_add_norm_fn = rms_norm_fn if isinstance(self.norm_f, RMSNorm) else layer_norm_fn
|
168 |
+
hidden_states = fused_add_norm_fn(
|
169 |
+
hidden_states,
|
170 |
+
self.norm_f.weight,
|
171 |
+
self.norm_f.bias,
|
172 |
+
eps=self.norm_f.eps,
|
173 |
+
residual=residual,
|
174 |
+
prenorm=False,
|
175 |
+
residual_in_fp32=self.residual_in_fp32,
|
176 |
+
)
|
177 |
+
return hidden_states
|
178 |
+
|
179 |
+
|
180 |
+
class MambaLMHeadModel(PreTrainedModel, GenerationMixin):
|
181 |
+
config_class = MambaConfig
|
182 |
+
|
183 |
+
def __init__(
|
184 |
+
self,
|
185 |
+
config,
|
186 |
+
initializer_cfg=None,
|
187 |
+
pad_vocab_size_multiple: int = 1,
|
188 |
+
device=None,
|
189 |
+
dtype=None,
|
190 |
+
**backbone_kwargs,
|
191 |
+
) -> None:
|
192 |
+
super().__init__(config)
|
193 |
+
d_model = config.d_model
|
194 |
+
n_layer = config.n_layer
|
195 |
+
vocab_size = config.vocab_size
|
196 |
+
factory_kwargs = {"device": device, "dtype": dtype}
|
197 |
+
|
198 |
+
if vocab_size % pad_vocab_size_multiple != 0:
|
199 |
+
vocab_size += pad_vocab_size_multiple - (vocab_size % pad_vocab_size_multiple)
|
200 |
+
self.backbone = MixerModel(
|
201 |
+
d_model=d_model,
|
202 |
+
n_layer=n_layer,
|
203 |
+
vocab_size=vocab_size,
|
204 |
+
initializer_cfg=initializer_cfg,
|
205 |
+
**backbone_kwargs,
|
206 |
+
**factory_kwargs,
|
207 |
+
)
|
208 |
+
self.lm_head = nn.Linear(d_model, vocab_size, bias=False, **factory_kwargs)
|
209 |
+
|
210 |
+
# Initialize weights and apply final processing
|
211 |
+
self.apply(
|
212 |
+
partial(
|
213 |
+
_init_weights,
|
214 |
+
n_layer=n_layer,
|
215 |
+
**(initializer_cfg if initializer_cfg is not None else {}),
|
216 |
+
)
|
217 |
+
)
|
218 |
+
self.tie_weights()
|
219 |
+
# _tied_weights_keys = ['lm_head.weight']
|
220 |
+
|
221 |
+
def tie_weights(self):
|
222 |
+
self.lm_head.weight = self.backbone.embedding.weight
|
223 |
+
|
224 |
+
def allocate_inference_cache(self, batch_size, max_seqlen, dtype=None, **kwargs):
|
225 |
+
return self.backbone.allocate_inference_cache(batch_size, max_seqlen, dtype=dtype, **kwargs)
|
226 |
+
|
227 |
+
def forward(
|
228 |
+
self,
|
229 |
+
input_ids,
|
230 |
+
position_ids=None,
|
231 |
+
inference_params=None,
|
232 |
+
num_last_tokens=0,
|
233 |
+
labels=None):
|
234 |
+
"""
|
235 |
+
"position_ids" is just to be compatible with Transformer generation. We don't use it.
|
236 |
+
num_last_tokens: if > 0, only return the logits for the last n tokens
|
237 |
+
"""
|
238 |
+
hidden_states = self.backbone(input_ids, inference_params=inference_params)
|
239 |
+
if num_last_tokens > 0:
|
240 |
+
hidden_states = hidden_states[:, -num_last_tokens:]
|
241 |
+
lm_logits = self.lm_head(hidden_states)
|
242 |
+
|
243 |
+
loss = None
|
244 |
+
if labels is not None:
|
245 |
+
logits = lm_logits
|
246 |
+
# Shift so that tokens < n predict n
|
247 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
248 |
+
shift_labels = labels[..., 1:].contiguous()
|
249 |
+
# Flatten the tokens
|
250 |
+
loss_fct = CrossEntropyLoss()
|
251 |
+
shift_logits = shift_logits.view(-1, self.config.vocab_size)
|
252 |
+
shift_labels = shift_labels.view(-1)
|
253 |
+
# Enable model parallelism
|
254 |
+
shift_labels = shift_labels.to(shift_logits.device)
|
255 |
+
loss = loss_fct(shift_logits, shift_labels)
|
256 |
+
return (loss,)
|
257 |
+
|
258 |
+
else:
|
259 |
+
CausalLMOutput = namedtuple("CausalLMOutput", ["logits"])
|
260 |
+
return CausalLMOutput(logits=lm_logits)
|