Add .znn files
Browse files- .gitattributes +1 -0
- model-00001-of-00004.safetensors → model-00001-of-00004.safetensors.znn +2 -2
- model-00002-of-00004.safetensors → model-00002-of-00004.safetensors.znn +2 -2
- model-00003-of-00004.safetensors → model-00003-of-00004.safetensors.znn +2 -2
- model-00004-of-00004.safetensors → model-00004-of-00004.safetensors.znn +2 -2
- model.safetensors.index.json +291 -291
- zipnn_compress_file.py +178 -0
- zipnn_compress_path.py +380 -0
- zipnn_decompress_file.py +101 -0
- zipnn_decompress_path.py +303 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.znn filter=lfs diff=lfs merge=lfs -text
|
model-00001-of-00004.safetensors → model-00001-of-00004.safetensors.znn
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0117fc3e4a200b75e9636311ff2551f7448738145bf0ac52387de6e4a53116aa
|
3 |
+
size 3306641296
|
model-00002-of-00004.safetensors → model-00002-of-00004.safetensors.znn
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e62e2800d343b335a8cdfbd3922edaedf02d4c7f500fb2e71f4bd839b8f36e7d
|
3 |
+
size 3320299056
|
model-00003-of-00004.safetensors → model-00003-of-00004.safetensors.znn
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79712ca84925579454ddcf2c98336033ad0ba57609f6154e96ad5ecf1c1cadb2
|
3 |
+
size 3260492185
|
model-00004-of-00004.safetensors → model-00004-of-00004.safetensors.znn
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:213823a6262dd9ffcbe8dd92cd518c1614cba2044b803bf2677465a3d999672c
|
3 |
+
size 775829578
|
model.safetensors.index.json
CHANGED
@@ -3,296 +3,296 @@
|
|
3 |
"total_size": 16060522496
|
4 |
},
|
5 |
"weight_map": {
|
6 |
-
"lm_head.weight": "model-00004-of-00004.safetensors",
|
7 |
-
"model.embed_tokens.weight": "model-00001-of-00004.safetensors",
|
8 |
-
"model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
9 |
-
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
10 |
-
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
11 |
-
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
12 |
-
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
13 |
-
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
14 |
-
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
15 |
-
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
16 |
-
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
17 |
-
"model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
18 |
-
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
19 |
-
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
20 |
-
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
21 |
-
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
22 |
-
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
23 |
-
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
24 |
-
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
25 |
-
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
26 |
-
"model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
27 |
-
"model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
28 |
-
"model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
29 |
-
"model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
30 |
-
"model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
31 |
-
"model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
32 |
-
"model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
33 |
-
"model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
34 |
-
"model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
35 |
-
"model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
36 |
-
"model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
37 |
-
"model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
38 |
-
"model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
39 |
-
"model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
40 |
-
"model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
41 |
-
"model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
42 |
-
"model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
43 |
-
"model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
44 |
-
"model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
45 |
-
"model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
46 |
-
"model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
47 |
-
"model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
48 |
-
"model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
49 |
-
"model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
50 |
-
"model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
51 |
-
"model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
52 |
-
"model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
53 |
-
"model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
54 |
-
"model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
55 |
-
"model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
56 |
-
"model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
57 |
-
"model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
58 |
-
"model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
59 |
-
"model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
60 |
-
"model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
61 |
-
"model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
62 |
-
"model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
63 |
-
"model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
64 |
-
"model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
65 |
-
"model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
66 |
-
"model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
67 |
-
"model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
68 |
-
"model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
69 |
-
"model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
70 |
-
"model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
71 |
-
"model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
72 |
-
"model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
73 |
-
"model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
74 |
-
"model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
75 |
-
"model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
76 |
-
"model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
77 |
-
"model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
78 |
-
"model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
79 |
-
"model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
80 |
-
"model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
81 |
-
"model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
82 |
-
"model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
83 |
-
"model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
84 |
-
"model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
85 |
-
"model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
86 |
-
"model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
87 |
-
"model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
88 |
-
"model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
89 |
-
"model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
90 |
-
"model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
91 |
-
"model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
92 |
-
"model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
93 |
-
"model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
94 |
-
"model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
95 |
-
"model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
96 |
-
"model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
97 |
-
"model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
98 |
-
"model.layers.18.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
99 |
-
"model.layers.18.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
100 |
-
"model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
101 |
-
"model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
102 |
-
"model.layers.18.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
103 |
-
"model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
104 |
-
"model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
105 |
-
"model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
106 |
-
"model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
107 |
-
"model.layers.19.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
108 |
-
"model.layers.19.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
109 |
-
"model.layers.19.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
110 |
-
"model.layers.19.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
111 |
-
"model.layers.19.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
112 |
-
"model.layers.19.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
113 |
-
"model.layers.19.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
114 |
-
"model.layers.19.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
115 |
-
"model.layers.19.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
116 |
-
"model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
117 |
-
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
118 |
-
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
119 |
-
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
120 |
-
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
121 |
-
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
122 |
-
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
123 |
-
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
124 |
-
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
125 |
-
"model.layers.20.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
126 |
-
"model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
127 |
-
"model.layers.20.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
128 |
-
"model.layers.20.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
129 |
-
"model.layers.20.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
130 |
-
"model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
131 |
-
"model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
132 |
-
"model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
133 |
-
"model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
134 |
-
"model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
135 |
-
"model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
136 |
-
"model.layers.21.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
137 |
-
"model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
138 |
-
"model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
139 |
-
"model.layers.21.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
140 |
-
"model.layers.21.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
141 |
-
"model.layers.21.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
142 |
-
"model.layers.21.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
143 |
-
"model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
144 |
-
"model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
145 |
-
"model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
146 |
-
"model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
147 |
-
"model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
148 |
-
"model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
149 |
-
"model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
150 |
-
"model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
151 |
-
"model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
152 |
-
"model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
153 |
-
"model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
154 |
-
"model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
155 |
-
"model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
156 |
-
"model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
157 |
-
"model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
158 |
-
"model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
159 |
-
"model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
160 |
-
"model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
161 |
-
"model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
162 |
-
"model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
163 |
-
"model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
164 |
-
"model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
165 |
-
"model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
166 |
-
"model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
167 |
-
"model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
168 |
-
"model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
169 |
-
"model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
170 |
-
"model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
171 |
-
"model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
172 |
-
"model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
173 |
-
"model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
174 |
-
"model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
175 |
-
"model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
176 |
-
"model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
177 |
-
"model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
178 |
-
"model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
179 |
-
"model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
180 |
-
"model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
181 |
-
"model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
182 |
-
"model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
183 |
-
"model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
184 |
-
"model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
185 |
-
"model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
186 |
-
"model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
187 |
-
"model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
188 |
-
"model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
189 |
-
"model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
190 |
-
"model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
191 |
-
"model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
192 |
-
"model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
193 |
-
"model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
194 |
-
"model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
195 |
-
"model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
196 |
-
"model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
197 |
-
"model.layers.28.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
198 |
-
"model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
199 |
-
"model.layers.28.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
200 |
-
"model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
201 |
-
"model.layers.28.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
202 |
-
"model.layers.28.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
203 |
-
"model.layers.28.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
204 |
-
"model.layers.28.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
205 |
-
"model.layers.28.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
206 |
-
"model.layers.29.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
207 |
-
"model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
208 |
-
"model.layers.29.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
209 |
-
"model.layers.29.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
210 |
-
"model.layers.29.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
211 |
-
"model.layers.29.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
212 |
-
"model.layers.29.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
213 |
-
"model.layers.29.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
214 |
-
"model.layers.29.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
215 |
-
"model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
216 |
-
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
217 |
-
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
218 |
-
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
219 |
-
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
220 |
-
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
221 |
-
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
222 |
-
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
223 |
-
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
224 |
-
"model.layers.30.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
225 |
-
"model.layers.30.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
226 |
-
"model.layers.30.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
227 |
-
"model.layers.30.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
228 |
-
"model.layers.30.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
229 |
-
"model.layers.30.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
230 |
-
"model.layers.30.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
231 |
-
"model.layers.30.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
232 |
-
"model.layers.30.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
233 |
-
"model.layers.31.input_layernorm.weight": "model-00004-of-00004.safetensors",
|
234 |
-
"model.layers.31.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
|
235 |
-
"model.layers.31.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
236 |
-
"model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
237 |
-
"model.layers.31.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
|
238 |
-
"model.layers.31.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
239 |
-
"model.layers.31.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
240 |
-
"model.layers.31.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
241 |
-
"model.layers.31.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
242 |
-
"model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
243 |
-
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
244 |
-
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
245 |
-
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
246 |
-
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
247 |
-
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
248 |
-
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
249 |
-
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
250 |
-
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
251 |
-
"model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
252 |
-
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
253 |
-
"model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
254 |
-
"model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
255 |
-
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
256 |
-
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
257 |
-
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
258 |
-
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
259 |
-
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
260 |
-
"model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
261 |
-
"model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
262 |
-
"model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
263 |
-
"model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
264 |
-
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
265 |
-
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
266 |
-
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
267 |
-
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
268 |
-
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
269 |
-
"model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
270 |
-
"model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
271 |
-
"model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
272 |
-
"model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
273 |
-
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
274 |
-
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
275 |
-
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
276 |
-
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
277 |
-
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
278 |
-
"model.layers.8.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
279 |
-
"model.layers.8.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
280 |
-
"model.layers.8.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
281 |
-
"model.layers.8.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
282 |
-
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
283 |
-
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
284 |
-
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
285 |
-
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
286 |
-
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
287 |
-
"model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
288 |
-
"model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
289 |
-
"model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
290 |
-
"model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
291 |
-
"model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
292 |
-
"model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
293 |
-
"model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
294 |
-
"model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
295 |
-
"model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
296 |
-
"model.norm.weight": "model-00004-of-00004.safetensors"
|
297 |
}
|
298 |
}
|
|
|
3 |
"total_size": 16060522496
|
4 |
},
|
5 |
"weight_map": {
|
6 |
+
"lm_head.weight": "model-00004-of-00004.safetensors.znn",
|
7 |
+
"model.embed_tokens.weight": "model-00001-of-00004.safetensors.znn",
|
8 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
9 |
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
10 |
+
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
11 |
+
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
12 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
13 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
14 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
15 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
16 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
17 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
18 |
+
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
19 |
+
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
20 |
+
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
21 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
22 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
23 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
24 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
25 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
26 |
+
"model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
27 |
+
"model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
28 |
+
"model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
29 |
+
"model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
30 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
31 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
32 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
33 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
34 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
35 |
+
"model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
36 |
+
"model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
37 |
+
"model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
38 |
+
"model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
39 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
40 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
41 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
42 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
43 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
44 |
+
"model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
45 |
+
"model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
46 |
+
"model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
47 |
+
"model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
48 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
49 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
50 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
51 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
52 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
53 |
+
"model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
54 |
+
"model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
55 |
+
"model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
56 |
+
"model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
57 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
58 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
59 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
60 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
61 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
62 |
+
"model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
63 |
+
"model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
64 |
+
"model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
65 |
+
"model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
66 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
67 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
68 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
69 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
70 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
71 |
+
"model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
72 |
+
"model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
73 |
+
"model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
74 |
+
"model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
75 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
76 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
77 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
78 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
79 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
80 |
+
"model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
81 |
+
"model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
82 |
+
"model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
83 |
+
"model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
84 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
85 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
86 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
87 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
88 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
89 |
+
"model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
90 |
+
"model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
91 |
+
"model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
92 |
+
"model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
93 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
94 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
95 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
96 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
97 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
98 |
+
"model.layers.18.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
99 |
+
"model.layers.18.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
100 |
+
"model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
101 |
+
"model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
102 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
103 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
104 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
105 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
106 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
107 |
+
"model.layers.19.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
108 |
+
"model.layers.19.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
109 |
+
"model.layers.19.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
110 |
+
"model.layers.19.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
111 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
112 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
113 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
114 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
115 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
116 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
117 |
+
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
118 |
+
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
119 |
+
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
120 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
121 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
122 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
123 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
124 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
125 |
+
"model.layers.20.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
126 |
+
"model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
127 |
+
"model.layers.20.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
128 |
+
"model.layers.20.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
129 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
130 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
131 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
132 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
133 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
134 |
+
"model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
135 |
+
"model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
136 |
+
"model.layers.21.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
137 |
+
"model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
138 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
139 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
140 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
141 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
142 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
143 |
+
"model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
144 |
+
"model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
145 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
146 |
+
"model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
147 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
148 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
149 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
150 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
151 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
152 |
+
"model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
153 |
+
"model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
154 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
155 |
+
"model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
156 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
157 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
158 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
159 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
160 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
161 |
+
"model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
162 |
+
"model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
163 |
+
"model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
164 |
+
"model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
165 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
166 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
167 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
168 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
169 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
170 |
+
"model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
171 |
+
"model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
172 |
+
"model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
173 |
+
"model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
174 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
175 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
176 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
177 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
178 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
179 |
+
"model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
180 |
+
"model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
181 |
+
"model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
182 |
+
"model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
183 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
184 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
185 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
186 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
187 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
188 |
+
"model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
189 |
+
"model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
190 |
+
"model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
191 |
+
"model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
192 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
193 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
194 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
195 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
196 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
197 |
+
"model.layers.28.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
198 |
+
"model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
199 |
+
"model.layers.28.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
200 |
+
"model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
201 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
202 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
203 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
204 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
205 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
206 |
+
"model.layers.29.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
207 |
+
"model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
208 |
+
"model.layers.29.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
209 |
+
"model.layers.29.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
210 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
211 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
212 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
213 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
214 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
215 |
+
"model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
216 |
+
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
217 |
+
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
218 |
+
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
219 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
220 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
221 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
222 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
223 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
224 |
+
"model.layers.30.input_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
225 |
+
"model.layers.30.mlp.down_proj.weight": "model-00003-of-00004.safetensors.znn",
|
226 |
+
"model.layers.30.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
227 |
+
"model.layers.30.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
228 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00003-of-00004.safetensors.znn",
|
229 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
230 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
231 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
232 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
233 |
+
"model.layers.31.input_layernorm.weight": "model-00004-of-00004.safetensors.znn",
|
234 |
+
"model.layers.31.mlp.down_proj.weight": "model-00004-of-00004.safetensors.znn",
|
235 |
+
"model.layers.31.mlp.gate_proj.weight": "model-00003-of-00004.safetensors.znn",
|
236 |
+
"model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors.znn",
|
237 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00004-of-00004.safetensors.znn",
|
238 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00003-of-00004.safetensors.znn",
|
239 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00003-of-00004.safetensors.znn",
|
240 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00003-of-00004.safetensors.znn",
|
241 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00003-of-00004.safetensors.znn",
|
242 |
+
"model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
243 |
+
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
244 |
+
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
245 |
+
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
246 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
247 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
248 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
249 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
250 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
251 |
+
"model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
252 |
+
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
253 |
+
"model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
254 |
+
"model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
255 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
256 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
257 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
258 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
259 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
260 |
+
"model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
261 |
+
"model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
262 |
+
"model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
263 |
+
"model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
264 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
265 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
266 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
267 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
268 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
269 |
+
"model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
270 |
+
"model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
271 |
+
"model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
272 |
+
"model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
273 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
274 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
275 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
276 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
277 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
278 |
+
"model.layers.8.input_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
279 |
+
"model.layers.8.mlp.down_proj.weight": "model-00001-of-00004.safetensors.znn",
|
280 |
+
"model.layers.8.mlp.gate_proj.weight": "model-00001-of-00004.safetensors.znn",
|
281 |
+
"model.layers.8.mlp.up_proj.weight": "model-00001-of-00004.safetensors.znn",
|
282 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00004.safetensors.znn",
|
283 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors.znn",
|
284 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors.znn",
|
285 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors.znn",
|
286 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors.znn",
|
287 |
+
"model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
288 |
+
"model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors.znn",
|
289 |
+
"model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors.znn",
|
290 |
+
"model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors.znn",
|
291 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors.znn",
|
292 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors.znn",
|
293 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors.znn",
|
294 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors.znn",
|
295 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors.znn",
|
296 |
+
"model.norm.weight": "model-00004-of-00004.safetensors.znn"
|
297 |
}
|
298 |
}
|
zipnn_compress_file.py
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import sys
|
4 |
+
import argparse
|
5 |
+
import time
|
6 |
+
|
7 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
8 |
+
|
9 |
+
KB = 1024
|
10 |
+
MB = 1024 * 1024
|
11 |
+
GB = 1024 * 1024 * 1024
|
12 |
+
|
13 |
+
RED = "\033[91m"
|
14 |
+
YELLOW = "\033[93m"
|
15 |
+
GREEN = "\033[92m"
|
16 |
+
RESET = "\033[0m"
|
17 |
+
|
18 |
+
def check_and_install_zipnn():
|
19 |
+
try:
|
20 |
+
import zipnn
|
21 |
+
except ImportError:
|
22 |
+
print("zipnn not found. Installing...")
|
23 |
+
subprocess.check_call(
|
24 |
+
[
|
25 |
+
sys.executable,
|
26 |
+
"-m",
|
27 |
+
"pip",
|
28 |
+
"install",
|
29 |
+
"zipnn",
|
30 |
+
"--upgrade",
|
31 |
+
]
|
32 |
+
)
|
33 |
+
import zipnn
|
34 |
+
|
35 |
+
|
36 |
+
def parse_streaming_chunk_size(
|
37 |
+
streaming_chunk_size,
|
38 |
+
):
|
39 |
+
if str(streaming_chunk_size).isdigit():
|
40 |
+
final = int(streaming_chunk_size)
|
41 |
+
else:
|
42 |
+
size_value = int(streaming_chunk_size[:-2])
|
43 |
+
size_unit = streaming_chunk_size[-2].lower()
|
44 |
+
|
45 |
+
if size_unit == "k":
|
46 |
+
final = KB * size_value
|
47 |
+
elif size_unit == "m":
|
48 |
+
final = MB * size_value
|
49 |
+
elif size_unit == "g":
|
50 |
+
final = GB * size_value
|
51 |
+
else:
|
52 |
+
raise ValueError(f"Invalid size unit: {size_unit}. Use 'k', 'm', or 'g'.")
|
53 |
+
|
54 |
+
return final
|
55 |
+
|
56 |
+
|
57 |
+
def compress_file(
|
58 |
+
input_file,
|
59 |
+
dtype="",
|
60 |
+
streaming_chunk_size=1048576,
|
61 |
+
delete=False,
|
62 |
+
force=False,
|
63 |
+
hf_cache=False,
|
64 |
+
):
|
65 |
+
import zipnn
|
66 |
+
|
67 |
+
streaming_chunk_size = parse_streaming_chunk_size(streaming_chunk_size)
|
68 |
+
full_path = input_file
|
69 |
+
if not os.path.exists(full_path):
|
70 |
+
print(f"{RED}File not found{RESET}")
|
71 |
+
return
|
72 |
+
if delete and not hf_cache:
|
73 |
+
print(f"Deleting {full_path}...")
|
74 |
+
os.remove(full_path)
|
75 |
+
else:
|
76 |
+
compressed_path = full_path + ".znn"
|
77 |
+
if not force and os.path.exists(compressed_path):
|
78 |
+
user_input = (
|
79 |
+
input(f"{compressed_path} already exists; overwrite (y/n)? ").strip().lower()
|
80 |
+
)
|
81 |
+
if user_input not in ("yes", "y"):
|
82 |
+
print(f"Skipping {full_path}...")
|
83 |
+
return
|
84 |
+
print(f"Compressing {full_path}...")
|
85 |
+
#
|
86 |
+
output_file = input_file + ".znn"
|
87 |
+
if dtype:
|
88 |
+
zpn = zipnn.ZipNN(
|
89 |
+
bytearray_dtype="float32",
|
90 |
+
is_streaming=True,
|
91 |
+
streaming_chunk_kb=streaming_chunk_size,
|
92 |
+
)
|
93 |
+
else:
|
94 |
+
zpn = zipnn.ZipNN(
|
95 |
+
is_streaming=True,
|
96 |
+
streaming_chunk_kb=streaming_chunk_size,
|
97 |
+
)
|
98 |
+
file_size_before = 0
|
99 |
+
file_size_after = 0
|
100 |
+
start_time = time.time()
|
101 |
+
with open(input_file, "rb") as infile, open(output_file, "wb") as outfile:
|
102 |
+
chunk = infile.read()
|
103 |
+
file_size_before += len(chunk)
|
104 |
+
compressed_chunk = zpn.compress(chunk)
|
105 |
+
if compressed_chunk:
|
106 |
+
file_size_after += len(compressed_chunk)
|
107 |
+
outfile.write(compressed_chunk)
|
108 |
+
end_time = time.time() - start_time
|
109 |
+
print(f"Compressed {input_file} to {output_file}")
|
110 |
+
print(
|
111 |
+
f"{GREEN}Original size: {file_size_before/GB:.02f}GB size after compression: {file_size_after/GB:.02f}GB, Remaining size is {file_size_after/file_size_before*100:.02f}% of original, time: {end_time:.02f}{RESET}"
|
112 |
+
)
|
113 |
+
|
114 |
+
if hf_cache:
|
115 |
+
# If the file is in the Hugging Face cache, fix the symlinks
|
116 |
+
print(f"{YELLOW}Reorganizing Hugging Face cache...{RESET}")
|
117 |
+
try:
|
118 |
+
snapshot_path = os.path.dirname(input_file)
|
119 |
+
blob_name = os.path.join(snapshot_path, os.readlink(input_file))
|
120 |
+
os.rename(output_file, blob_name)
|
121 |
+
os.symlink(blob_name, output_file)
|
122 |
+
if os.path.exists(input_file):
|
123 |
+
os.remove(input_file)
|
124 |
+
except Exception as e:
|
125 |
+
raise Exception(f"Error reorganizing Hugging Face cache: {e}")
|
126 |
+
|
127 |
+
if __name__ == "__main__":
|
128 |
+
if len(sys.argv) < 2:
|
129 |
+
print("Usage: python compress_files.py <suffix>")
|
130 |
+
print("Example: python compress_files.py 'safetensors'")
|
131 |
+
sys.exit(1)
|
132 |
+
|
133 |
+
parser = argparse.ArgumentParser(description="Enter a file path to compress.")
|
134 |
+
parser.add_argument(
|
135 |
+
"input_file",
|
136 |
+
type=str,
|
137 |
+
help="Specify the path to the file to compress.",
|
138 |
+
)
|
139 |
+
parser.add_argument(
|
140 |
+
"--float32",
|
141 |
+
action="store_true",
|
142 |
+
help="A flag that triggers float32 compression",
|
143 |
+
)
|
144 |
+
parser.add_argument(
|
145 |
+
"--streaming_chunk_size",
|
146 |
+
type=str,
|
147 |
+
help="An optional streaming chunk size. The format is int (for size in Bytes) or int+KB/MB/GB. Default is 1MB",
|
148 |
+
)
|
149 |
+
parser.add_argument(
|
150 |
+
"--delete",
|
151 |
+
action="store_true",
|
152 |
+
help="A flag that triggers deletion of a single file instead of compression",
|
153 |
+
)
|
154 |
+
parser.add_argument(
|
155 |
+
"--force",
|
156 |
+
action="store_true",
|
157 |
+
help="A flag that forces overwriting when compressing.",
|
158 |
+
)
|
159 |
+
parser.add_argument(
|
160 |
+
"--hf_cache",
|
161 |
+
action="store_true",
|
162 |
+
help="A flag that indicates if the file is in the Hugging Face cache.",
|
163 |
+
)
|
164 |
+
args = parser.parse_args()
|
165 |
+
optional_kwargs = {}
|
166 |
+
if args.float32:
|
167 |
+
optional_kwargs["dtype"] = 32
|
168 |
+
if args.streaming_chunk_size is not None:
|
169 |
+
optional_kwargs["streaming_chunk_size"] = args.streaming_chunk_size
|
170 |
+
if args.delete:
|
171 |
+
optional_kwargs["delete"] = args.delete
|
172 |
+
if args.force:
|
173 |
+
optional_kwargs["force"] = args.force
|
174 |
+
if args.hf_cache:
|
175 |
+
optional_kwargs["hf_cache"] = args.hf_cache
|
176 |
+
|
177 |
+
check_and_install_zipnn()
|
178 |
+
compress_file(args.input_file, **optional_kwargs)
|
zipnn_compress_path.py
ADDED
@@ -0,0 +1,380 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import sys
|
4 |
+
import argparse
|
5 |
+
from pathlib import Path
|
6 |
+
from concurrent.futures import (
|
7 |
+
ProcessPoolExecutor,
|
8 |
+
as_completed,
|
9 |
+
)
|
10 |
+
from zipnn_compress_file import compress_file
|
11 |
+
|
12 |
+
sys.path.append(
|
13 |
+
os.path.abspath(
|
14 |
+
os.path.join(
|
15 |
+
os.path.dirname(__file__), ".."
|
16 |
+
)
|
17 |
+
)
|
18 |
+
)
|
19 |
+
|
20 |
+
|
21 |
+
KB = 1024
|
22 |
+
MB = 1024 * 1024
|
23 |
+
GB = 1024 * 1024 * 1024
|
24 |
+
|
25 |
+
RED = "\033[91m"
|
26 |
+
YELLOW = "\033[93m"
|
27 |
+
GREEN = "\033[92m"
|
28 |
+
RESET = "\033[0m"
|
29 |
+
|
30 |
+
|
31 |
+
def check_and_install_zipnn():
|
32 |
+
try:
|
33 |
+
import zipnn
|
34 |
+
except ImportError:
|
35 |
+
print("zipnn not found. Installing...")
|
36 |
+
subprocess.check_call(
|
37 |
+
[
|
38 |
+
sys.executable,
|
39 |
+
"-m",
|
40 |
+
"pip",
|
41 |
+
"install",
|
42 |
+
"zipnn",
|
43 |
+
"--upgrade",
|
44 |
+
]
|
45 |
+
)
|
46 |
+
import zipnn
|
47 |
+
|
48 |
+
|
49 |
+
def parse_streaming_chunk_size(
|
50 |
+
streaming_chunk_size,
|
51 |
+
):
|
52 |
+
if str(streaming_chunk_size).isdigit():
|
53 |
+
final = int(streaming_chunk_size)
|
54 |
+
else:
|
55 |
+
size_value = int(
|
56 |
+
streaming_chunk_size[:-2]
|
57 |
+
)
|
58 |
+
size_unit = streaming_chunk_size[
|
59 |
+
-2
|
60 |
+
].lower()
|
61 |
+
|
62 |
+
if size_unit == "k":
|
63 |
+
final = KB * size_value
|
64 |
+
elif size_unit == "m":
|
65 |
+
final = MB * size_value
|
66 |
+
elif size_unit == "g":
|
67 |
+
final = GB * size_value
|
68 |
+
else:
|
69 |
+
raise ValueError(
|
70 |
+
f"Invalid size unit: {size_unit}. Use 'k', 'm', or 'g'."
|
71 |
+
)
|
72 |
+
|
73 |
+
return final
|
74 |
+
|
75 |
+
def replace_in_file(file_path: Path | str, old: str, new: str) -> None:
|
76 |
+
"""Given a file_path, replace all occurrences of `old` with `new` inpalce."""
|
77 |
+
|
78 |
+
with open(file_path, 'r') as file:
|
79 |
+
file_data = file.read()
|
80 |
+
|
81 |
+
file_data = file_data.replace(old, new)
|
82 |
+
|
83 |
+
with open(file_path, 'w') as file:
|
84 |
+
file.write(file_data)
|
85 |
+
|
86 |
+
def compress_files_with_suffix(
|
87 |
+
suffix,
|
88 |
+
dtype="",
|
89 |
+
streaming_chunk_size=1048576,
|
90 |
+
path=".",
|
91 |
+
delete=False,
|
92 |
+
r=False,
|
93 |
+
force=False,
|
94 |
+
max_processes=1,
|
95 |
+
hf_cache=False,
|
96 |
+
model="",
|
97 |
+
branch="main",
|
98 |
+
):
|
99 |
+
import zipnn
|
100 |
+
|
101 |
+
overwrite_first=True
|
102 |
+
file_list = []
|
103 |
+
streaming_chunk_size = (
|
104 |
+
parse_streaming_chunk_size(
|
105 |
+
streaming_chunk_size
|
106 |
+
)
|
107 |
+
)
|
108 |
+
if model:
|
109 |
+
if not hf_cache:
|
110 |
+
raise ValueError(
|
111 |
+
"Must specify --hf_cache when using --model"
|
112 |
+
)
|
113 |
+
try:
|
114 |
+
from huggingface_hub import scan_cache_dir
|
115 |
+
except ImportError:
|
116 |
+
raise ImportError(
|
117 |
+
"huggingface_hub not found. Please pip install huggingface_hub."
|
118 |
+
)
|
119 |
+
cache = scan_cache_dir()
|
120 |
+
repo = next((repo for repo in cache.repos if repo.repo_id == model), None)
|
121 |
+
|
122 |
+
if repo is not None:
|
123 |
+
print(f"Found repo {model} in cache")
|
124 |
+
|
125 |
+
# Get the latest revision path
|
126 |
+
hash = ''
|
127 |
+
try:
|
128 |
+
with open(os.path.join(repo.repo_path, 'refs', branch), "r") as ref:
|
129 |
+
hash = ref.read()
|
130 |
+
except FileNotFoundError:
|
131 |
+
raise FileNotFoundError(f"Branch {branch} not found in repo {model}")
|
132 |
+
|
133 |
+
path = os.path.join(repo.repo_path, 'snapshots', hash)
|
134 |
+
|
135 |
+
directories_to_search = (
|
136 |
+
os.walk(path)
|
137 |
+
if r
|
138 |
+
else [(path, [], os.listdir(path))]
|
139 |
+
)
|
140 |
+
files_found = False
|
141 |
+
for root, _, files in directories_to_search:
|
142 |
+
for file_name in files:
|
143 |
+
if file_name.endswith(suffix):
|
144 |
+
compressed_path = (
|
145 |
+
file_name + ".znn"
|
146 |
+
)
|
147 |
+
if not force and os.path.exists(
|
148 |
+
compressed_path
|
149 |
+
):
|
150 |
+
#
|
151 |
+
if overwrite_first:
|
152 |
+
overwrite_first=False
|
153 |
+
user_input = (
|
154 |
+
input(
|
155 |
+
f"Compressed files already exists; Would you like to overwrite them all (y/n)? "
|
156 |
+
)
|
157 |
+
.strip()
|
158 |
+
.lower()
|
159 |
+
)
|
160 |
+
if user_input not in (
|
161 |
+
"y",
|
162 |
+
"yes",
|
163 |
+
):
|
164 |
+
print(
|
165 |
+
f"No forced overwriting."
|
166 |
+
)
|
167 |
+
else:
|
168 |
+
print(
|
169 |
+
f"Overwriting all compressed files."
|
170 |
+
)
|
171 |
+
force=True
|
172 |
+
#
|
173 |
+
if not force:
|
174 |
+
user_input = (
|
175 |
+
input(
|
176 |
+
f"{compressed_path} already exists; overwrite (y/n)? "
|
177 |
+
)
|
178 |
+
.strip()
|
179 |
+
.lower()
|
180 |
+
)
|
181 |
+
if user_input not in (
|
182 |
+
"y",
|
183 |
+
"yes",
|
184 |
+
):
|
185 |
+
print(
|
186 |
+
f"Skipping {file_name}..."
|
187 |
+
)
|
188 |
+
continue
|
189 |
+
files_found = True
|
190 |
+
full_path = os.path.join(
|
191 |
+
root, file_name
|
192 |
+
)
|
193 |
+
file_list.append(full_path)
|
194 |
+
|
195 |
+
if file_list and hf_cache:
|
196 |
+
try:
|
197 |
+
from transformers.utils import (
|
198 |
+
SAFE_WEIGHTS_INDEX_NAME,
|
199 |
+
WEIGHTS_INDEX_NAME
|
200 |
+
)
|
201 |
+
except ImportError:
|
202 |
+
raise ImportError(
|
203 |
+
"Transformers not found. Please pip install transformers."
|
204 |
+
)
|
205 |
+
|
206 |
+
if os.path.exists(os.path.join(path, SAFE_WEIGHTS_INDEX_NAME)):
|
207 |
+
print(f"{YELLOW}Fixing Hugging Face model json...{RESET}")
|
208 |
+
blob_name = os.path.join(path, os.readlink(os.path.join(path, SAFE_WEIGHTS_INDEX_NAME)))
|
209 |
+
replace_in_file(
|
210 |
+
file_path=blob_name,
|
211 |
+
old=f"{suffix}",
|
212 |
+
new=f"{suffix}.znn"
|
213 |
+
)
|
214 |
+
elif os.path.exists(os.path.join(path, WEIGHTS_INDEX_NAME)):
|
215 |
+
print(f"{YELLOW}Fixing Hugging Face model json...{RESET}")
|
216 |
+
blob_name = os.path.join(path, os.readlink(os.path.join(path, WEIGHTS_INDEX_NAME)))
|
217 |
+
replace_in_file(
|
218 |
+
file_path=blob_name,
|
219 |
+
old=f"{suffix}",
|
220 |
+
new=f"{suffix}.znn"
|
221 |
+
)
|
222 |
+
|
223 |
+
with ProcessPoolExecutor(
|
224 |
+
max_workers=max_processes
|
225 |
+
) as executor:
|
226 |
+
future_to_file = {
|
227 |
+
executor.submit(
|
228 |
+
compress_file,
|
229 |
+
file,
|
230 |
+
dtype,
|
231 |
+
streaming_chunk_size,
|
232 |
+
delete,
|
233 |
+
True,
|
234 |
+
hf_cache,
|
235 |
+
): file
|
236 |
+
for file in file_list[:max_processes]
|
237 |
+
}
|
238 |
+
file_list = file_list[max_processes:]
|
239 |
+
while future_to_file:
|
240 |
+
for future in as_completed(
|
241 |
+
future_to_file
|
242 |
+
):
|
243 |
+
file = future_to_file.pop(future)
|
244 |
+
|
245 |
+
try:
|
246 |
+
future.result()
|
247 |
+
except Exception as exc:
|
248 |
+
print(
|
249 |
+
f"{RED}File {file} generated an exception: {exc}{RESET}"
|
250 |
+
)
|
251 |
+
|
252 |
+
if file_list:
|
253 |
+
next_file = file_list.pop(0)
|
254 |
+
future_to_file[
|
255 |
+
executor.submit(
|
256 |
+
compress_file,
|
257 |
+
next_file,
|
258 |
+
dtype,
|
259 |
+
streaming_chunk_size,
|
260 |
+
delete,
|
261 |
+
True,
|
262 |
+
hf_cache,
|
263 |
+
)
|
264 |
+
] = next_file
|
265 |
+
|
266 |
+
if not files_found:
|
267 |
+
print(
|
268 |
+
f"{RED}No files with the suffix '{suffix}' found.{RESET}"
|
269 |
+
)
|
270 |
+
|
271 |
+
print(f"{GREEN}All files compressed{RESET}")
|
272 |
+
|
273 |
+
|
274 |
+
if __name__ == "__main__":
|
275 |
+
if len(sys.argv) < 2:
|
276 |
+
print(
|
277 |
+
"Usage: python compress_files.py <suffix>"
|
278 |
+
)
|
279 |
+
print(
|
280 |
+
"Example: python compress_files.py 'safetensors'"
|
281 |
+
)
|
282 |
+
sys.exit(1)
|
283 |
+
|
284 |
+
parser = argparse.ArgumentParser(
|
285 |
+
description="Enter a suffix to compress, (optional) dtype, (optional) streaming chunk size, (optional) path to files."
|
286 |
+
)
|
287 |
+
parser.add_argument(
|
288 |
+
"suffix",
|
289 |
+
type=str,
|
290 |
+
help="Specify the file suffix to compress all files with that suffix. If a single file name is provided, only that file will be compressed.",
|
291 |
+
)
|
292 |
+
parser.add_argument(
|
293 |
+
"--float32",
|
294 |
+
action="store_true",
|
295 |
+
help="A flag that triggers float32 compression",
|
296 |
+
)
|
297 |
+
parser.add_argument(
|
298 |
+
"--streaming_chunk_size",
|
299 |
+
type=str,
|
300 |
+
help="An optional streaming chunk size. The format is int (for size in Bytes) or int+KB/MB/GB. Default is 1MB",
|
301 |
+
)
|
302 |
+
parser.add_argument(
|
303 |
+
"--path",
|
304 |
+
type=str,
|
305 |
+
help="Path to files to compress",
|
306 |
+
)
|
307 |
+
parser.add_argument(
|
308 |
+
"--delete",
|
309 |
+
action="store_true",
|
310 |
+
help="A flag that triggers deletion of a single file instead of compression",
|
311 |
+
)
|
312 |
+
parser.add_argument(
|
313 |
+
"-r",
|
314 |
+
action="store_true",
|
315 |
+
help="A flag that triggers recursive search on all subdirectories",
|
316 |
+
)
|
317 |
+
parser.add_argument(
|
318 |
+
"--recursive",
|
319 |
+
action="store_true",
|
320 |
+
help="A flag that triggers recursive search on all subdirectories",
|
321 |
+
)
|
322 |
+
parser.add_argument(
|
323 |
+
"--force",
|
324 |
+
action="store_true",
|
325 |
+
help="A flag that forces overwriting when compressing.",
|
326 |
+
)
|
327 |
+
parser.add_argument(
|
328 |
+
"--max_processes",
|
329 |
+
type=int,
|
330 |
+
help="The amount of maximum processes.",
|
331 |
+
)
|
332 |
+
parser.add_argument(
|
333 |
+
"--hf_cache",
|
334 |
+
action="store_true",
|
335 |
+
help="A flag that indicates if the file is in the Hugging Face cache. Must either specify --model or --path to the model's snapshot cache.",
|
336 |
+
)
|
337 |
+
parser.add_argument(
|
338 |
+
"--model",
|
339 |
+
type=str,
|
340 |
+
help="Only when using --hf_cache, specify the model name or path. E.g. 'ibm-granite/granite-7b-instruct'",
|
341 |
+
)
|
342 |
+
parser.add_argument(
|
343 |
+
"--model_branch",
|
344 |
+
type=str,
|
345 |
+
default="main",
|
346 |
+
help="Only when using --model, specify the model branch. Default is 'main'",
|
347 |
+
)
|
348 |
+
args = parser.parse_args()
|
349 |
+
optional_kwargs = {}
|
350 |
+
if args.float32:
|
351 |
+
optional_kwargs["dtype"] = 32
|
352 |
+
if args.streaming_chunk_size is not None:
|
353 |
+
optional_kwargs[
|
354 |
+
"streaming_chunk_size"
|
355 |
+
] = args.streaming_chunk_size
|
356 |
+
if args.path is not None:
|
357 |
+
optional_kwargs["path"] = args.path
|
358 |
+
if args.delete:
|
359 |
+
optional_kwargs["delete"] = args.delete
|
360 |
+
if args.r or args.recursive:
|
361 |
+
optional_kwargs["r"] = args.r
|
362 |
+
if args.force:
|
363 |
+
optional_kwargs["force"] = args.force
|
364 |
+
if args.max_processes:
|
365 |
+
optional_kwargs["max_processes"] = (
|
366 |
+
args.max_processes
|
367 |
+
)
|
368 |
+
if args.hf_cache:
|
369 |
+
optional_kwargs["hf_cache"] = args.hf_cache
|
370 |
+
if args.model:
|
371 |
+
optional_kwargs["model"] = args.model
|
372 |
+
if args.model_branch:
|
373 |
+
optional_kwargs[
|
374 |
+
"branch"
|
375 |
+
] = args.model_branch
|
376 |
+
|
377 |
+
check_and_install_zipnn()
|
378 |
+
compress_files_with_suffix(
|
379 |
+
args.suffix, **optional_kwargs
|
380 |
+
)
|
zipnn_decompress_file.py
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import sys
|
4 |
+
import argparse
|
5 |
+
|
6 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
7 |
+
|
8 |
+
RED = "\033[91m"
|
9 |
+
YELLOW = "\033[93m"
|
10 |
+
GREEN = "\033[92m"
|
11 |
+
RESET = "\033[0m"
|
12 |
+
|
13 |
+
|
14 |
+
def check_and_install_zipnn():
|
15 |
+
try:
|
16 |
+
import zipnn
|
17 |
+
except ImportError:
|
18 |
+
print("zipnn not found. Installing...")
|
19 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "zipnn"])
|
20 |
+
import zipnn
|
21 |
+
|
22 |
+
|
23 |
+
def decompress_file(input_file, delete=False, force=False, hf_cache=False):
|
24 |
+
import zipnn
|
25 |
+
|
26 |
+
if not input_file.endswith(".znn"):
|
27 |
+
raise ValueError("Input file does not have the '.znn' suffix")
|
28 |
+
|
29 |
+
if os.path.exists(input_file):
|
30 |
+
if delete and not hf_cache:
|
31 |
+
print(f"Deleting {input_file}...")
|
32 |
+
os.remove(input_file)
|
33 |
+
else:
|
34 |
+
decompressed_path = input_file[:-4]
|
35 |
+
if not force and os.path.exists(decompressed_path):
|
36 |
+
|
37 |
+
user_input = (
|
38 |
+
input(f"{decompressed_path} already exists; overwrite (y/n)? ").strip().lower()
|
39 |
+
)
|
40 |
+
|
41 |
+
if user_input not in ("yes", "y"):
|
42 |
+
print(f"Skipping {input_file}...")
|
43 |
+
return
|
44 |
+
print(f"Decompressing {input_file}...")
|
45 |
+
|
46 |
+
output_file = input_file[:-4]
|
47 |
+
zpn = zipnn.ZipNN(is_streaming=True)
|
48 |
+
|
49 |
+
with open(input_file, "rb") as infile, open(output_file, "wb") as outfile:
|
50 |
+
d_data = b""
|
51 |
+
chunk = infile.read()
|
52 |
+
d_data += zpn.decompress(chunk)
|
53 |
+
outfile.write(d_data)
|
54 |
+
print(f"Decompressed {input_file} to {output_file}")
|
55 |
+
|
56 |
+
if hf_cache:
|
57 |
+
# If the file is in the Hugging Face cache, fix the symlinks
|
58 |
+
print(f"{YELLOW}Reorganizing Hugging Face cache...{RESET}")
|
59 |
+
try:
|
60 |
+
snapshot_path = os.path.dirname(input_file)
|
61 |
+
blob_name = os.path.join(snapshot_path, os.readlink(input_file))
|
62 |
+
os.rename(output_file, blob_name)
|
63 |
+
os.symlink(blob_name, output_file)
|
64 |
+
|
65 |
+
if os.path.exists(input_file):
|
66 |
+
os.remove(input_file)
|
67 |
+
except Exception as e:
|
68 |
+
raise Exception(f"Error reorganizing Hugging Face cache: {e}")
|
69 |
+
|
70 |
+
else:
|
71 |
+
print(f"Error: The file {input_file} does not exist.")
|
72 |
+
|
73 |
+
|
74 |
+
if __name__ == "__main__":
|
75 |
+
check_and_install_zipnn()
|
76 |
+
|
77 |
+
parser = argparse.ArgumentParser(description="Enter a file path to decompress.")
|
78 |
+
parser.add_argument("input_file", type=str, help="Specify the path to the file to decompress.")
|
79 |
+
parser.add_argument(
|
80 |
+
"--delete",
|
81 |
+
action="store_true",
|
82 |
+
help="A flag that triggers deletion of a single compressed file instead of decompression",
|
83 |
+
)
|
84 |
+
parser.add_argument(
|
85 |
+
"--force", action="store_true", help="A flag that forces overwriting when decompressing."
|
86 |
+
)
|
87 |
+
parser.add_argument(
|
88 |
+
"--hf_cache",
|
89 |
+
action="store_true",
|
90 |
+
help="A flag that indicates if the file is in the Hugging Face cache.",
|
91 |
+
)
|
92 |
+
args = parser.parse_args()
|
93 |
+
optional_kwargs = {}
|
94 |
+
if args.delete:
|
95 |
+
optional_kwargs["delete"] = args.delete
|
96 |
+
if args.force:
|
97 |
+
optional_kwargs["force"] = args.force
|
98 |
+
if args.hf_cache:
|
99 |
+
optional_kwargs["hf_cache"] = args.hf_cache
|
100 |
+
|
101 |
+
decompress_file(args.input_file, **optional_kwargs)
|
zipnn_decompress_path.py
ADDED
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import argparse
|
4 |
+
import subprocess
|
5 |
+
from pathlib import Path
|
6 |
+
from concurrent.futures import (
|
7 |
+
ProcessPoolExecutor,
|
8 |
+
as_completed,
|
9 |
+
)
|
10 |
+
from zipnn_decompress_file import (
|
11 |
+
decompress_file,
|
12 |
+
)
|
13 |
+
|
14 |
+
sys.path.append(
|
15 |
+
os.path.abspath(
|
16 |
+
os.path.join(
|
17 |
+
os.path.dirname(__file__),
|
18 |
+
"..",
|
19 |
+
)
|
20 |
+
)
|
21 |
+
)
|
22 |
+
|
23 |
+
RED = "\033[91m"
|
24 |
+
YELLOW = "\033[93m"
|
25 |
+
GREEN = "\033[92m"
|
26 |
+
RESET = "\033[0m"
|
27 |
+
|
28 |
+
def check_and_install_zipnn():
|
29 |
+
try:
|
30 |
+
import zipnn
|
31 |
+
except ImportError:
|
32 |
+
print("zipnn not found. Installing...")
|
33 |
+
subprocess.check_call(
|
34 |
+
[
|
35 |
+
sys.executable,
|
36 |
+
"-m",
|
37 |
+
"pip",
|
38 |
+
"install",
|
39 |
+
"zipnn",
|
40 |
+
]
|
41 |
+
)
|
42 |
+
import zipnn
|
43 |
+
|
44 |
+
def replace_in_file(file_path: Path | str, old: str, new: str) -> None:
|
45 |
+
"""Given a file_path, replace all occurrences of `old` with `new` inpalce."""
|
46 |
+
|
47 |
+
with open(file_path, 'r') as file:
|
48 |
+
file_data = file.read()
|
49 |
+
|
50 |
+
file_data = file_data.replace(old, new)
|
51 |
+
|
52 |
+
with open(file_path, 'w') as file:
|
53 |
+
file.write(file_data)
|
54 |
+
|
55 |
+
def decompress_znn_files(
|
56 |
+
path=".",
|
57 |
+
delete=False,
|
58 |
+
force=False,
|
59 |
+
max_processes=1,
|
60 |
+
hf_cache=False,
|
61 |
+
model="",
|
62 |
+
branch="main",
|
63 |
+
):
|
64 |
+
import zipnn
|
65 |
+
|
66 |
+
overwrite_first=True
|
67 |
+
|
68 |
+
if model:
|
69 |
+
if not hf_cache:
|
70 |
+
raise ValueError(
|
71 |
+
"Must specify --hf_cache when using --model"
|
72 |
+
)
|
73 |
+
try:
|
74 |
+
from huggingface_hub import scan_cache_dir
|
75 |
+
except ImportError:
|
76 |
+
raise ImportError(
|
77 |
+
"huggingface_hub not found. Please pip install huggingface_hub."
|
78 |
+
)
|
79 |
+
cache = scan_cache_dir()
|
80 |
+
repo = next((repo for repo in cache.repos if repo.repo_id == model), None)
|
81 |
+
|
82 |
+
if repo is not None:
|
83 |
+
print(f"Found repo {model} in cache")
|
84 |
+
|
85 |
+
# Get the latest revision path
|
86 |
+
hash = ''
|
87 |
+
try:
|
88 |
+
with open(os.path.join(repo.repo_path, 'refs', branch), "r") as ref:
|
89 |
+
hash = ref.read()
|
90 |
+
except FileNotFoundError:
|
91 |
+
raise FileNotFoundError(f"Branch {branch} not found in repo {model}")
|
92 |
+
|
93 |
+
path = os.path.join(repo.repo_path, 'snapshots', hash)
|
94 |
+
|
95 |
+
file_list = []
|
96 |
+
directories_to_search = [
|
97 |
+
(
|
98 |
+
path,
|
99 |
+
[],
|
100 |
+
os.listdir(path),
|
101 |
+
)
|
102 |
+
]
|
103 |
+
for (
|
104 |
+
root,
|
105 |
+
_,
|
106 |
+
files,
|
107 |
+
) in directories_to_search:
|
108 |
+
for file_name in files:
|
109 |
+
if file_name.endswith(".znn"):
|
110 |
+
decompressed_path = file_name[:-4]
|
111 |
+
if not force and os.path.exists(
|
112 |
+
decompressed_path
|
113 |
+
):
|
114 |
+
#
|
115 |
+
if overwrite_first:
|
116 |
+
overwrite_first=False
|
117 |
+
user_input = (
|
118 |
+
input(
|
119 |
+
f"Decompressed files already exists; Would you like to overwrite them all (y/n)? "
|
120 |
+
)
|
121 |
+
.strip()
|
122 |
+
.lower()
|
123 |
+
)
|
124 |
+
if user_input not in (
|
125 |
+
"y",
|
126 |
+
"yes",
|
127 |
+
):
|
128 |
+
print(
|
129 |
+
f"No forced overwriting."
|
130 |
+
)
|
131 |
+
else:
|
132 |
+
print(
|
133 |
+
f"Overwriting all decompressed files."
|
134 |
+
)
|
135 |
+
force=True
|
136 |
+
|
137 |
+
#
|
138 |
+
if not force:
|
139 |
+
user_input = (
|
140 |
+
input(
|
141 |
+
f"{decompressed_path} already exists; overwrite (y/n)? "
|
142 |
+
)
|
143 |
+
.strip()
|
144 |
+
.lower()
|
145 |
+
)
|
146 |
+
if user_input not in (
|
147 |
+
"y",
|
148 |
+
"yes",
|
149 |
+
):
|
150 |
+
print(
|
151 |
+
f"Skipping {file_name}..."
|
152 |
+
)
|
153 |
+
continue
|
154 |
+
full_path = os.path.join(
|
155 |
+
root,
|
156 |
+
file_name,
|
157 |
+
)
|
158 |
+
file_list.append(full_path)
|
159 |
+
|
160 |
+
if file_list and hf_cache:
|
161 |
+
try:
|
162 |
+
from transformers.utils import (
|
163 |
+
SAFE_WEIGHTS_INDEX_NAME,
|
164 |
+
WEIGHTS_INDEX_NAME
|
165 |
+
)
|
166 |
+
except ImportError:
|
167 |
+
raise ImportError(
|
168 |
+
"Transformers not found. Please pip install transformers."
|
169 |
+
)
|
170 |
+
|
171 |
+
suffix = file_list[0].split('/')[-1].split('.')[-2] # get the one before .znn
|
172 |
+
|
173 |
+
if os.path.exists(os.path.join(path, SAFE_WEIGHTS_INDEX_NAME)):
|
174 |
+
print(f"{YELLOW}Fixing Hugging Face model json...{RESET}")
|
175 |
+
blob_name = os.path.join(path, os.readlink(os.path.join(path, SAFE_WEIGHTS_INDEX_NAME)))
|
176 |
+
replace_in_file(
|
177 |
+
file_path=blob_name,
|
178 |
+
old=f"{suffix}.znn",
|
179 |
+
new=f"{suffix}"
|
180 |
+
)
|
181 |
+
elif os.path.exists(os.path.join(path, WEIGHTS_INDEX_NAME)):
|
182 |
+
print(f"{YELLOW}Fixing Hugging Face model json...{RESET}")
|
183 |
+
blob_name = os.path.join(path, os.readlink(os.path.join(path, WEIGHTS_INDEX_NAME)))
|
184 |
+
replace_in_file(
|
185 |
+
file_path=blob_name,
|
186 |
+
old=f"{suffix}.znn",
|
187 |
+
new=f"{suffix}"
|
188 |
+
)
|
189 |
+
|
190 |
+
with ProcessPoolExecutor(
|
191 |
+
max_workers=max_processes
|
192 |
+
) as executor:
|
193 |
+
for file in file_list[:max_processes]:
|
194 |
+
future_to_file = {
|
195 |
+
executor.submit(
|
196 |
+
decompress_file,
|
197 |
+
file,
|
198 |
+
delete,
|
199 |
+
True,
|
200 |
+
hf_cache,
|
201 |
+
): file
|
202 |
+
for file in file_list[
|
203 |
+
:max_processes
|
204 |
+
]
|
205 |
+
}
|
206 |
+
|
207 |
+
file_list = file_list[max_processes:]
|
208 |
+
while future_to_file:
|
209 |
+
|
210 |
+
for future in as_completed(
|
211 |
+
future_to_file
|
212 |
+
):
|
213 |
+
file = future_to_file.pop(
|
214 |
+
future
|
215 |
+
)
|
216 |
+
try:
|
217 |
+
future.result()
|
218 |
+
except Exception as exc:
|
219 |
+
print(
|
220 |
+
f"{RED}File {file} generated an exception: {exc}{RESET}"
|
221 |
+
)
|
222 |
+
|
223 |
+
if file_list:
|
224 |
+
next_file = file_list.pop(
|
225 |
+
0
|
226 |
+
)
|
227 |
+
future_to_file[
|
228 |
+
executor.submit(
|
229 |
+
decompress_file,
|
230 |
+
next_file,
|
231 |
+
delete,
|
232 |
+
True,
|
233 |
+
hf_cache,
|
234 |
+
)
|
235 |
+
] = next_file
|
236 |
+
#
|
237 |
+
print(f"{GREEN}All files decompressed{RESET}")
|
238 |
+
|
239 |
+
|
240 |
+
if __name__ == "__main__":
|
241 |
+
check_and_install_zipnn()
|
242 |
+
|
243 |
+
parser = argparse.ArgumentParser(
|
244 |
+
description="Compresses all .znn files."
|
245 |
+
)
|
246 |
+
parser.add_argument(
|
247 |
+
"--path",
|
248 |
+
type=str,
|
249 |
+
help="Path to folder of files to decompress. If left empty, checks current folder.",
|
250 |
+
)
|
251 |
+
parser.add_argument(
|
252 |
+
"--delete",
|
253 |
+
action="store_true",
|
254 |
+
help="A flag that triggers deletion of a single compressed file instead of decompression",
|
255 |
+
)
|
256 |
+
parser.add_argument(
|
257 |
+
"--force",
|
258 |
+
action="store_true",
|
259 |
+
help="A flag that forces overwriting when decompressing.",
|
260 |
+
)
|
261 |
+
parser.add_argument(
|
262 |
+
"--max_processes",
|
263 |
+
type=int,
|
264 |
+
help="The amount of maximum processes.",
|
265 |
+
)
|
266 |
+
parser.add_argument(
|
267 |
+
"--hf_cache",
|
268 |
+
action="store_true",
|
269 |
+
help="A flag that indicates if the file is in the Hugging Face cache. Must either specify --model or --path to the model's snapshot cache.",
|
270 |
+
)
|
271 |
+
parser.add_argument(
|
272 |
+
"--model",
|
273 |
+
type=str,
|
274 |
+
help="Only when using --hf_cache, specify the model name or path. E.g. 'ibm-granite/granite-7b-instruct'",
|
275 |
+
)
|
276 |
+
parser.add_argument(
|
277 |
+
"--model_branch",
|
278 |
+
type=str,
|
279 |
+
default="main",
|
280 |
+
help="Only when using --model, specify the model branch. Default is 'main'",
|
281 |
+
)
|
282 |
+
args = parser.parse_args()
|
283 |
+
optional_kwargs = {}
|
284 |
+
if args.path is not None:
|
285 |
+
optional_kwargs["path"] = args.path
|
286 |
+
if args.delete:
|
287 |
+
optional_kwargs["delete"] = args.delete
|
288 |
+
if args.force:
|
289 |
+
optional_kwargs["force"] = args.force
|
290 |
+
if args.max_processes:
|
291 |
+
optional_kwargs["max_processes"] = (
|
292 |
+
args.max_processes
|
293 |
+
)
|
294 |
+
if args.hf_cache:
|
295 |
+
optional_kwargs["hf_cache"] = args.hf_cache
|
296 |
+
if args.model:
|
297 |
+
optional_kwargs["model"] = args.model
|
298 |
+
if args.model_branch:
|
299 |
+
optional_kwargs[
|
300 |
+
"branch"
|
301 |
+
] = args.model_branch
|
302 |
+
|
303 |
+
decompress_znn_files(**optional_kwargs)
|