|
Download README.md from doandung/128-IT-Coder: direct link, hf CLI and curl.
- Browser
- Download file 4.51 kB
-
https://huggingface.co/doandung/128-IT-Coder/resolve/main/README.md
- Command line
-
hf download hf://doandung/128-IT-Coder/README.md
-
curl -L -o README.md https://huggingface.co/doandung/128-IT-Coder/resolve/main/README.md
4.51 kB
| license: mit | |
| base_model: deepseek-ai/DeepSeek-V4-Pro | |
| tags: | |
| - deepseek-v4 | |
| - moe-pruning | |
| - it-coder | |
| - 128-experts | |
| # DeepSeek-V4-Pro 128-IT-Coder (`doandung/128-IT-Coder`) | |
| Kho lưu trữ mô hình và bộ công cụ **Phẫu Thuật Cuốn Chiếu (Streaming MoE Surgery)** rút trích chính xác **128/384 Ô Chuyên Gia (Routed Experts)** tinh hoa nhất về **Lập trình, Thuật toán, Kiến trúc Hệ thống, Bảo mật & Tiếng Việt/Anh Kỹ thuật** từ mô hình gốc [`deepseek-ai/DeepSeek-V4-Pro`](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro) (**61 tầng chính + 1 tầng MTP = 64 shards**). | |
| --- | |
| ## 1. Thông Số Kiến Trúc Sau Phẫu Thuật (`128 / 384 Ô`) | |
| * **Mô hình gốc:** `deepseek-ai/DeepSeek-V4-Pro` (`805.32 GB`, 64 files `.safetensors`) | |
| * **Kiến trúc đặc trưng của DeepSeek-V4-Pro được bảo toàn 100%:** | |
| * **Hyper-Connections (`hc_mult = 4`):** Giữ nguyên toàn bộ ma trận kết hợp Sinkhorn-Knopp 20 vòng lặp (`hc_attn_*`, `hc_ffn_*`, `hc_head_*`). | |
| * **Multi-head Latent Attention + KV Compressor + Indexer (`layers.{0..60}.attn.*`):** Giữ nguyên 100% ở chuẩn **FP8 (`float8_e4m3fn` + `float8_e8m0fnu` scale)**. | |
| * **Shared Experts (`ffn.shared_experts`):** Giữ nguyên 100% ở chuẩn **FP8**. | |
| * **Router Scoring (`sqrtsoftplus`):** | |
| * **Tầng 0, 1, 2 (`num_hash_layers = 3`):** Cắt `ffn.gate.weight` từ `[384, 7168]` $\rightarrow$ `[128, 7168]` và ánh xạ lại bảng `ffn.gate.tid2eid` (`[129280, 6]`) về hệ chỉ số mới `0..127` theo độ tương đồng Cosine trong từng nhóm. | |
| * **Tầng 3..60 & `mtp.0`:** Cắt `ffn.gate.weight` $\rightarrow$ `[128, 7168]` và `ffn.gate.bias` $\rightarrow$ `[128]`. | |
| * **128 Ô Chuyên Gia IT-Coder (`ffn.experts.0..127`):** Tuyển chọn theo thuật toán **Group-Aware Hybrid Peak-Energy** (**8 nhóm $\times$ 16 ô/nhóm = 128 ô**, gồm **11 Ghế Đa năng + 5 Ghế Đặc cách Logic $P_{99.5}$**), giữ nguyên chuẩn siêu nén **MXFP4 (`int8` packed `e2m1fn_x2` + `float8_e8m0fnu` scale)**. | |
| --- | |
| ## 2. Những Gì Đã Được Chuẩn Bị Sẵn Trên Kho `doandung/128-IT-Coder` | |
| 1. **`calibration_data/calibration_6500_it.pt`**: Bộ đề mồi **6.500 cuộc hội thoại IT-Coder** (Luồng A $\alpha=2.5\times$ + Luồng B $\beta=1.0\times$) đã được mã hóa sẵn bằng Tokenizer chuẩn (`vocab_size = 129,280`) của `DeepSeek-V4-Pro`. | |
| 2. **`surgery_schedule.json`**: Bản đồ phân bổ chính xác toàn bộ **64 shards (`model-00001-of-00064.safetensors` $\rightarrow$ `model-00064-of-00064.safetensors`)** của `DeepSeek-V4-Pro` (mỗi tầng nằm gọn trong đúng 1 file ~13.5 GB!). | |
| 3. **`config.json` & `inference/config.json`**: Đã cập nhật `"n_routed_experts": 128`, kèm trọn bộ `tokenizer.json`, `inference/model.py`, `inference/convert.py`, `inference/kernel.py`. | |
| 4. **Bộ 4 Module Phẫu Thuật & Notebook Colab (`colab_runner.ipynb`)**: Sẵn sàng chạy cuốn chiếu trên Google Colab Pro / Pro+. | |
| --- | |
| ## 3. Cách Chạy Phẫu Thuật 61 Tầng Trên Google Colab Pro / Pro+ | |
| Mở Google Colab Pro (GPU A100/L4), tải file [`colab_runner.ipynb`](colab_runner.ipynb) lên hoặc chạy trực tiếp đoạn lệnh 1 chạm sau trong 1 ô Code của Colab: | |
| ```bash | |
| export HF_TOKEN="hf_..." # Dán Hugging Face Write Token của bạn vào đây | |
| pip install -q -U torch safetensors huggingface_hub datasets transformers accelerate | |
| python -c " | |
| import os | |
| from huggingface_hub import snapshot_download | |
| snapshot_download( | |
| repo_id='doandung/128-IT-Coder', | |
| local_dir='.', | |
| allow_patterns=['*.py', '*.json', 'calibration_data/*', 'inference/*', 'encoding/*'], | |
| token=os.environ.get('HF_TOKEN') | |
| ) | |
| " | |
| # Chạy Phẫu Thuật Cuốn Chiếu 61 Tầng + MTP (Tự động đẩy từng tầng lên doandung/128-IT-Coder & tự Resume nếu đứt mạng) | |
| python step3_streaming_surgery_colab.py \ | |
| --model-source "deepseek-ai/DeepSeek-V4-Pro" \ | |
| --schedule-path "./surgery_schedule.json" \ | |
| --calibration-path "./calibration_data/calibration_6500_it.pt" \ | |
| --output-dir "./pruned_128_model" \ | |
| --batch-size 25 \ | |
| --push-to-hub "doandung/128-IT-Coder" | |
| # Sau khi hoàn tất 64 shards, đóng gói model.safetensors.index.json & Kiểm định Audit: | |
| python step4_finalize_and_verify.py \ | |
| --model-source "deepseek-ai/DeepSeek-V4-Pro" \ | |
| --pruned-dir "./pruned_128_model" \ | |
| --target-experts 128 \ | |
| --push-to-hub "doandung/128-IT-Coder" | |
| ``` | |