Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: zai-org/GLM-5.3-Flash
|
| 3 |
+
library_name: compressed-tensors
|
| 4 |
+
tags:
|
| 5 |
+
- moe
|
| 6 |
+
- expert-pruning
|
| 7 |
+
- compressed-tensors
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# GLM-5.3-Flash - 50% Expert Pruned
|
| 11 |
+
|
| 12 |
+
50% of the MoE experts pruned by router-weight magnitude using [compressed-tensors](https://github.com/vllm-project/compressed-tensors).
|
| 13 |
+
|
| 14 |
+
- **Base model:** [zai-org/GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash)
|
| 15 |
+
- **Sparsity:** 50% of routed experts removed per layer
|
| 16 |
+
- **Layers pruned:** all 43 MoE layers (body layers 3–44 + MTP layer 45)
|
| 17 |
+
- **Shared experts:** untouched
|
| 18 |
+
- **Vision tower:** untouched (dense ViT MLP, no MoE experts)
|
| 19 |
+
|
| 20 |
+
## Reproduction
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
from compressed_tensors.entrypoints.convert import convert_checkpoint, MagnitudeExpertPruner
|
| 24 |
+
|
| 25 |
+
convert_checkpoint(
|
| 26 |
+
model_stub="zai-org/GLM-5.3-Flash",
|
| 27 |
+
save_directory="GLM-5.3-Flash-MEP50",
|
| 28 |
+
converter=MagnitudeExpertPruner.from_pretrained(
|
| 29 |
+
"zai-org/GLM-5.3-Flash",
|
| 30 |
+
router_pattern=r"model\.language_model\.layers\.\d+\.mlp\.gate\.weight$",
|
| 31 |
+
expert_pattern=(
|
| 32 |
+
r"model\.language_model\.layers\.\d+\.mlp\.experts\.\d+\."
|
| 33 |
+
r"(gate_proj|up_proj|down_proj)\.(weight|weight_scale_inv)$"
|
| 34 |
+
),
|
| 35 |
+
sparsity=0.5,
|
| 36 |
+
),
|
| 37 |
+
max_workers=8,
|
| 38 |
+
)
|
| 39 |
+
```
|