Skip to content

Commit 50c2a16

Browse files
committed
update
1 parent 1ebcf2b commit 50c2a16

12 files changed

Lines changed: 686 additions & 878 deletions

File tree

‎README.md‎

Lines changed: 129 additions & 236 deletions
Large diffs are not rendered by default.

‎README_en.md‎

Lines changed: 129 additions & 236 deletions
Large diffs are not rendered by default.

‎README_zh.md‎

Lines changed: 130 additions & 237 deletions
Large diffs are not rendered by default.

‎assets/overview_infra_and_acc.png‎

1.46 MB
Loading

‎assets/slai-trex-logo.png‎

938 KB
Loading

‎cpt_data_construction/README.md‎

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
# CPT Data Construction
22

3-
This module is reserved for continual pre-training data construction in the OR domain.
3+
This module records the public release scope for the OR-CPT data construction stage of **SLAI T-Rex**.
44

5-
Planned contents:
5+
In the technical report, OR-CPT data is built through a solver-verified synthesis engine: parameterized optimization generators create structured instances, Gurobi verifies feasibility and objective values, business-oriented problem statements are rendered, executable formulations are reconstructed, and contract checks decide whether a document is eligible for CPT.
66

7-
- raw corpus collection recipes;
8-
- document cleaning and deduplication;
9-
- OR-domain filtering;
10-
- tokenizer-length packing;
11-
- dataset cards and release scripts.
7+
## Current Release
128

13-
Current status: placeholder.
9+
This directory is a design placeholder. The production OR-CPT engine, private raw corpora, solver logs, and generated full-scale CPT documents are not included in this repository release.
1410

11+
The released repository instead provides:
12+
13+
- the technical report PDF and LaTeX source archive at the repository root;
14+
- the runnable SFT data distillation toolkit in `../sft_data_construction`;
15+
- CPT conversion and training launch templates in `../cpt_training`.
16+
17+
## Target Pipeline
18+
19+
```text
20+
OR source resources
21+
-> generator contracts
22+
-> parameterized optimization instance
23+
-> solver execution and objective verification
24+
-> business problem rendering
25+
-> executable formulation reconstruction
26+
-> contract checks
27+
-> solver-verified CPT document
28+
```
29+
30+
## Release Requirements
31+
32+
Future public releases of this module should include:
33+
34+
- generator contracts and schema definitions;
35+
- static validation rules for variables, constraints, units, and objective direction;
36+
- independent solver execution scripts;
37+
- objective-matching and feasibility checks;
38+
- provenance metadata from source resource to exported CPT document;
39+
- dataset cards that separate public, synthetic, and private-source components.
40+
41+
For runnable SFT data generation today, start from [sft_data_construction](../sft_data_construction/).

‎cpt_training/README.md‎

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
# 2. CPT Training
1+
# CPT Training
22

3-
This module provides a MindSpeed-LLM example for continual pre-training (CPT) on OR-domain text corpora. The scripts are model/runtime templates: edit paths through environment variables, keep generated checkpoints and logs outside this repository, and run them inside a prepared MindSpeed-LLM environment.
3+
This module provides **SLAI T-Rex** MindSpeed-LLM templates for OR-oriented continued pre-training (CPT) on Ascend 910C environments.
4+
5+
The scripts are launch templates, not a self-contained training stack. Keep MindSpeed-LLM, MindSpeed, CANN, custom operators, private checkpoints, logs, and generated datasets outside this repository.
46

57
## Files
68

79
```text
810
cpt_training/
911
├── scripts/
10-
│ ├── convert_data.sh # JSONL/text -> MindSpeed indexed dataset
11-
│ ├── train_cpt_deepseek4_flash_4k.sh # DeepSeek-V4-Flash CPT launcher
12-
│ ├── convert_ckpt_hf_to_mcore.sh
13-
│ └── convert_ckpt_mcore_to_hf.sh
12+
│ ├── convert_data.sh # JSONL/text -> MindSpeed indexed dataset
13+
│ ├── train_cpt_deepseek4_flash_4k.sh # DeepSeek-V4-Flash CPT launcher
14+
│ ├── convert_ckpt_hf_to_mcore.sh # HuggingFace -> MindSpeed/Megatron-Core
15+
│ └── convert_ckpt_mcore_to_hf.sh # MindSpeed/Megatron-Core -> HuggingFace
1416
└── README.md
1517
```
1618

17-
## 0. Environment
19+
## Environment
1820

19-
Required external repositories:
21+
Prepare the external runtime first:
2022

2123
```bash
2224
export MINDSPEED_LLM_DIR=/path/to/MindSpeed-LLM
2325
export MINDSPEED_DIR=/path/to/MindSpeed
2426
```
2527

26-
Common runtime variables:
28+
Common variables:
2729

2830
```bash
2931
export TOKENIZER_PATH=/path/to/DeepSeek-V4-Flash
@@ -32,18 +34,18 @@ export CUSTOM_TRANSFORMER_ENV=/usr/local/Ascend/cann/opp/vendors/custom_transfor
3234
export CONDA_ENV=your_conda_env_name
3335
```
3436

35-
## 1. Convert CPT Corpus
37+
## Convert CPT Corpus
3638

37-
Input data should contain a text field, for example:
39+
Input JSONL should expose a text field:
3840

3941
```json
40-
{"text": "A clean OR-domain document or paragraph ..."}
42+
{"text": "A solver-verified OR document, formulation note, or cleaned domain paragraph ..."}
4143
```
4244

4345
Convert one dataset:
4446

4547
```bash
46-
cd ORproject/cpt_training
48+
cd SLAI-T-Rex/cpt_training
4749

4850
bash scripts/convert_data.sh \
4951
--mindspeed-llm-dir "$MINDSPEED_LLM_DIR" \
@@ -57,13 +59,13 @@ bash scripts/convert_data.sh \
5759
--n-subs 16
5860
```
5961

60-
The training prefix passed later is usually:
62+
The training prefix is usually:
6163

6264
```text
6365
/path/to/processed/or_cpt_corpus_text_document
6466
```
6567

66-
Manifest batch conversion is also supported:
68+
Batch conversion through a manifest is also supported:
6769

6870
```bash
6971
bash scripts/convert_data.sh \
@@ -78,15 +80,15 @@ Manifest format:
7880
```text
7981
# name input_path output_prefix workers n_subs log_interval
8082
or_books /path/to/books.jsonl /path/to/processed/or_books 8 16 1000
81-
or_notes /path/to/notes.jsonl /path/to/processed/or_notes 8 16 1000
83+
or_solver_docs /path/to/solver_docs.jsonl /path/to/processed/or_solver_docs 8 16 1000
8284
```
8385

84-
## 2. Convert HF Checkpoint to MCore
86+
## Convert Checkpoint to MCore
8587

86-
If your source checkpoint is FP8 HF format, first convert it to BF16 with:
88+
If the source checkpoint is FP8 HuggingFace format, first prepare a BF16 HuggingFace checkpoint:
8789

8890
```bash
89-
cd ORproject/model_download_deployment
91+
cd SLAI-T-Rex/model_download_deployment
9092

9193
export MINDSPEED_LLM_DIR=/path/to/MindSpeed-LLM
9294
export INPUT_FP8_HF_PATH=/path/to/deepseek4_fp8_hf
@@ -95,29 +97,29 @@ export OUTPUT_BF16_HF_PATH=/path/to/deepseek4_bf16_hf
9597
bash scripts/convert_ckpt_fp8_to_bf16.sh
9698
```
9799

98-
Then use the BF16 HF checkpoint as `HF_LOAD_DIR`:
100+
Then convert BF16 HuggingFace to MindSpeed/Megatron-Core:
99101

100102
```bash
101-
cd ORproject/cpt_training
103+
cd SLAI-T-Rex/cpt_training
102104

103105
export HF_LOAD_DIR=/path/to/deepseek4_flash_bf16_hf
104106
export MCORE_SAVE_DIR=/path/to/deepseek4_flash_mcore
105107

106108
bash scripts/convert_ckpt_hf_to_mcore.sh
107109
```
108110

109-
## 3. Run CPT
111+
## Run CPT
110112

111-
`TRAIN_DATA_PATH` follows MindSpeed weighted dataset syntax. Use one line per dataset:
113+
`TRAIN_DATA_PATH` follows MindSpeed weighted dataset syntax:
112114

113115
```bash
114-
cd ORproject/cpt_training
116+
cd SLAI-T-Rex/cpt_training
115117

116118
export CKPT_LOAD_DIR=/path/to/deepseek4_flash_mcore
117119
export OUTPUT_ROOT=/path/to/training_outputs/cpt
118120
export VALID_DATA_PATH=/path/to/processed/validation_text_document
119121

120-
export TRAIN_DATA_PATH=$'0.7 /path/to/processed/or_books_text_document\n0.3 /path/to/processed/or_notes_text_document'
122+
export TRAIN_DATA_PATH=$'0.7 /path/to/processed/or_books_text_document\n0.3 /path/to/processed/or_solver_docs_text_document'
121123

122124
export NNODES=8
123125
export NPUS_PER_NODE=16
@@ -128,7 +130,7 @@ export NODE_RANK=0
128130
bash scripts/train_cpt_deepseek4_flash_4k.sh
129131
```
130132

131-
Important defaults in `scripts/train_cpt_deepseek4_flash_4k.sh`:
133+
Important defaults:
132134

133135
```text
134136
SEQ_LEN=4096
@@ -140,9 +142,9 @@ MIN_LR=3.0e-7
140142
TP=1, PP=4, EP=32, CP=1
141143
```
142144

143-
Override them with environment variables only after you have confirmed the hardware layout and batch size.
145+
Override them only after matching the hardware topology, sequence packing, and checkpoint parallelism.
144146

145-
## 4. Outputs
147+
## Outputs
146148

147149
```text
148150
$OUTPUT_ROOT/checkpoints/<run_id>/ MCore checkpoints
@@ -151,12 +153,12 @@ $OUTPUT_ROOT/archive/<run_id>/ copied script, config.json, logs, metric
151153
$OUTPUT_ROOT/model_registry/ optional registry metadata
152154
```
153155

154-
The script refuses to silently overwrite an incomplete checkpoint. Use `FORCE_RERUN=1` only when you intentionally want to rerun from scratch.
156+
The launcher avoids silently overwriting incomplete checkpoints. Set `FORCE_RERUN=1` only when you intentionally want to rerun from scratch.
155157

156-
## 5. Convert MCore Back to HF
158+
## Convert MCore Back to HuggingFace
157159

158160
```bash
159-
cd ORproject/cpt_training
161+
cd SLAI-T-Rex/cpt_training
160162

161163
export MCORE_LOAD_DIR=/path/to/cpt_checkpoint
162164
export HF_SAVE_DIR=/path/to/cpt_checkpoint_hf

‎docs/README.md‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# Documentation
22

3-
This directory is reserved for extended documentation, design notes, and dataset cards.
3+
This directory is the documentation index for **SLAI T-Rex**.
44

5-
Current status: placeholder.
5+
The root README gives the public quick start. Module-level READMEs document runnable commands. This directory is reserved for longer notes that do not belong in the root entry point.
66

7+
Planned documents:
8+
9+
- OR-CPT engine design and trust path;
10+
- SFT data schema and quality-gate details;
11+
- CPT/SFT provenance manifests;
12+
- Ascend 910C training recipe notes;
13+
- model card and dataset card drafts;
14+
- benchmark reproduction notes where public artifacts allow it.
15+
16+
For now, use:
17+
18+
- [../README.md](../README.md) for the project overview;
19+
- [../SLAI T-Rex.pdf](../SLAI%20T-Rex.pdf) for the technical report;
20+
- [../sft_data_construction/README.md](../sft_data_construction/README.md) for runnable SFT data construction;
21+
- [../cpt_training/README.md](../cpt_training/README.md) and [../sft_training/README.md](../sft_training/README.md) for training templates.

‎examples/README.md‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
# Examples
22

3-
This directory is reserved for end-to-end examples that connect CPT data, CPT training, SFT data, and SFT training.
3+
This directory is the example index for **SLAI T-Rex**.
44

5-
Current status: placeholder.
5+
The current runnable example lives inside the SFT data construction package:
66

7+
```text
8+
../sft_data_construction/examples/configs/demo.yaml
9+
../sft_data_construction/examples/seeds/small_seed.jsonl
10+
```
11+
12+
Run it without calling an LLM:
13+
14+
```bash
15+
cd SLAI-T-Rex/sft_data_construction
16+
python3 -m or_data_distill run \
17+
--config examples/configs/demo.yaml \
18+
--dry-run
19+
```
20+
21+
Future examples should connect the full public workflow:
22+
23+
```text
24+
public OR seed subset
25+
-> SFT data distillation dry-run
26+
-> real OpenAI-compatible generation
27+
-> SFT JSONL validation
28+
-> MindSpeed data conversion
29+
-> SFT launcher configuration
30+
-> HF export and evaluation manifest
31+
```
32+
33+
Large checkpoints, private cluster configs, solver licenses, and production evaluation data should stay outside this repository.
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# 5. 模型下载与部署
1+
# Model Download and Deployment
22

3-
本模块用于放置模型下载、权重准备和部署相关脚本。当前已提供 DeepSeek-V4 FP8 HuggingFace checkpoint 转 BF16 HuggingFace checkpoint 的准备脚本,便于后续继续进行 MindSpeed/Megatron-Core 权重转换、CPT/SFT 或 BF16 推理部署。
3+
This module contains checkpoint preparation and deployment notes for **SLAI T-Rex**.
44

5-
## 文件说明
5+
The current public script prepares DeepSeek-V4-family HuggingFace checkpoints by converting FP8 weights to BF16 HuggingFace format. The resulting checkpoint can then be converted to MindSpeed/Megatron-Core format for CPT or SFT, or used by compatible BF16 inference stacks.
6+
7+
## Files
68

79
```text
810
model_download_deployment/
@@ -11,20 +13,16 @@ model_download_deployment/
1113
└── README.md
1214
```
1315

14-
## FP8 权重转 BF16
15-
16-
部分 DeepSeek-V4 系列 HuggingFace 权重可能以 FP8 形式发布。继续转换到 MindSpeed/Megatron-Core,或用于部分 BF16 推理流程前,可以先转为 BF16 HF checkpoint。
16+
## FP8 HuggingFace to BF16 HuggingFace
1717

18-
依赖:
18+
Some DeepSeek-V4-family HuggingFace checkpoints may be distributed in FP8 format. Before MindSpeed/Megatron-Core conversion or BF16 inference, prepare a BF16 HuggingFace checkpoint:
1919

2020
```bash
21-
python -m pip install torchao
21+
python3 -m pip install torchao
2222
```
2323

24-
运行:
25-
2624
```bash
27-
cd ORproject/model_download_deployment
25+
cd SLAI-T-Rex/model_download_deployment
2826

2927
export MINDSPEED_LLM_DIR=/path/to/MindSpeed-LLM
3028
export INPUT_FP8_HF_PATH=/path/to/deepseek4_fp8_hf
@@ -33,12 +31,20 @@ export OUTPUT_BF16_HF_PATH=/path/to/deepseek4_bf16_hf
3331
bash scripts/convert_ckpt_fp8_to_bf16.sh
3432
```
3533

36-
输出目录 `OUTPUT_BF16_HF_PATH` 仍是 HuggingFace checkpoint,可继续作为 `cpt_training/scripts/convert_ckpt_hf_to_mcore.sh``HF_LOAD_DIR`,转换为 MindSpeed/Megatron-Core 格式。
34+
The output directory remains a HuggingFace checkpoint. Use it as `HF_LOAD_DIR` for:
35+
36+
```text
37+
../cpt_training/scripts/convert_ckpt_hf_to_mcore.sh
38+
```
39+
40+
## Deployment Boundary
41+
42+
The technical report evaluates a full post-training chain from CPT to SFT, HF export, serving, and benchmark evaluation. This repository currently releases only the checkpoint preparation script and training-side conversion hooks.
3743

38-
## 后续计划
44+
Future additions should include:
3945

40-
- 已发布模型列表;
41-
- 模型下载命令;
42-
- 本地推理服务启动命令;
43-
- OpenAI-compatible API 部署示例;
44-
- 不同硬件环境下的部署注意事项。
46+
- released model list and download commands;
47+
- HuggingFace export checks;
48+
- local inference and OpenAI-compatible serving examples;
49+
- Ascend-specific deployment notes;
50+
- provenance manifests linking training checkpoint, exported HF artifact, served model, and benchmark score.

0 commit comments

Comments
 (0)