IvanHU commited on
Commit
ae9bd2d
·
verified ·
1 Parent(s): 34a2d27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +149 -148
README.md CHANGED
@@ -1,148 +1,149 @@
1
- ---
2
- license: mit
3
- ---
4
-
5
- # IMPORTANT NOTICE: THIS IS AN INTERMEDIATE CHECKPOINT, NOT THE FINAL MODEL
6
-
7
- Both [**YuLan-Mini**](https://huggingface.co/yulan-team/YuLan-Mini) and **YuLan-Mini-Intermediate-4K** were trained starting from this checkpoint.
8
-
9
- This version includes the optimizer, allowing you to resume training using the Hugging Face Trainer and DeepSpeed Universal Checkpoint.
10
-
11
- For easier inference and deployment, we merged the re-parameterized added parameters and scaling factors into the final released models ([**YuLan-Mini**](https://huggingface.co/yulan-team/YuLan-Mini) and **YuLan-Mini-Intermediate-4K**), enabling it to run on the Llama architecture. However, these parameters are still retained in the intermediate checkpoints from the training process.
12
-
13
- ## What you can do with these pre-training resources
14
-
15
- 1. **Pre-train** your own LLM. You can use [our data](https://huggingface.co/yulan-team/YuLan-Mini-Datasets) and curriculum to train a model that's just as powerful as YuLan-Mini.
16
- 2. Perform your own **learning rate annealing**. During the annealing phase, YuLan-Mini's learning ability is at its peak. You can resume training from [the checkpoint before annealing](https://huggingface.co/yulan-team/YuLan-Mini-Before-Annealing) and use your own dataset for learning rate annealing.
17
- 3. **Fine-tune** the Instruct version of the LLM. You can use the YuLan-Mini base model to train your own Instruct version.
18
- 4. **Training dynamics** research. You can use YuLan-Mini's intermediate checkpoints to explore internal changes during the pre-training process.
19
- 5. **Synthesize** your own data. You can use YuLan-Mini's [data pipeline](https://github.com/RUC-GSAI/YuLan-Mini) to clean and generate your own dataset.
20
-
21
-
22
- ## Continual Training Tutorial
23
-
24
- ### Step 1: Modify the `config.json`
25
-
26
- Due to the implementation of Hugging Face Trainer, certain parameters are stored in the `config.json` file and cannot be modified through the Trainer's command-line arguments. Therefore, you need to update these parameters in the `config.json` file first, particularly:
27
-
28
- - **`save_steps`**: The frequency of saving intermediate checkpoints.
29
- - **`train_batch_size`**: The batch size per GPU (equivalent to `per_device_train_batch_size` in the Trainer). We used a batch size of 1008 (approximately 4M tokens) during the stable training stage. Maintaining this same batch size is equally important for training effectiveness.
30
-
31
- Below is an example of a properly configured `config.json` file:
32
-
33
- ```json
34
- {
35
- "best_metric": null,
36
- "best_model_checkpoint": null,
37
- "epoch": 0.0,
38
- "eval_steps": 500,
39
- "global_step": 0,
40
- "is_hyper_param_search": false,
41
- "is_local_process_zero": true,
42
- "is_world_process_zero": true,
43
- "log_history": [],
44
- "logging_steps": 3,
45
- "max_steps": 0,
46
- "num_input_tokens_seen": 0,
47
- "num_train_epochs": 0,
48
- "save_steps": 250,
49
- "stateful_callbacks": {
50
- "TrainerControl": {
51
- "args": {
52
- "should_epoch_stop": false,
53
- "should_evaluate": false,
54
- "should_log": false,
55
- "should_save": true,
56
- "should_training_stop": true
57
- },
58
- "attributes": {}
59
- }
60
- },
61
- "total_flos": 0,
62
- "train_batch_size": 3,
63
- "trial_name": null,
64
- "trial_params": null
65
- }
66
- ```
67
-
68
- ### Step 2: Enable Universal Checkpointing in the DeepSpeed Configuration
69
-
70
- To ensure DeepSpeed Integration loads the Universal Checkpoint, you need to enable this feature in the DeepSpeed configuration JSON file.
71
-
72
- Here is an example of a ZeRO2 configuration with Universal Checkpointing enabled:
73
-
74
- ```json
75
- {
76
- "bf16": {
77
- "enabled": "auto"
78
- },
79
- "zero_optimization": {
80
- "stage": 2,
81
- "allgather_partitions": true,
82
- "allgather_bucket_size": 8e8,
83
- "overlap_comm": true,
84
- "reduce_scatter": true,
85
- "reduce_bucket_size": 8e8,
86
- "contiguous_gradients": true
87
- },
88
- "gradient_accumulation_steps": "auto",
89
- "gradient_clipping": "auto",
90
- "steps_per_print": 16,
91
- "train_batch_size": "auto",
92
- "train_micro_batch_size_per_gpu": "auto",
93
- "wall_clock_breakdown": false,
94
- "dump_state": true,
95
- "optimizer": {
96
- "type": "AdamW",
97
- "params": {
98
- "lr": "auto",
99
- "betas": "auto",
100
- "eps": "auto",
101
- "weight_decay": "auto"
102
- }
103
- },
104
- "checkpoint": {
105
- "load_universal": true
106
- }
107
- }
108
- ```
109
-
110
- ### Step 3: Resume Training
111
-
112
- When calling `trainer.train`, include the `resume_from_checkpoint` argument to load the distributed optimizer state from the Universal Checkpoint and resume training.
113
-
114
- ```python
115
- trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint)
116
- ```
117
-
118
- We provide an internal [training framework](https://github.com/RUC-GSAI/YuLan-Mini/tree/main/pretrain) for your reference, but you are free to choose other frameworks.
119
-
120
-
121
- ---
122
-
123
- ## The Team
124
-
125
- YuLan-Mini is developed and maintained by [AI Box, Renmin University of China](http://aibox.ruc.edu.cn/).
126
-
127
- ## License
128
-
129
- - The code in this repository is released under the [MIT License](./LICENSE).
130
- - Policies regarding the use of model weights, intermediate optimizer states, and training data will be announced in future updates.
131
- - Limitations: Despite our efforts to mitigate safety concerns and encourage the generation of ethical and lawful text, the probabilistic nature of language models may still lead to unexpected outputs. For instance, responses might contain bias, discrimination, or other harmful content. Please refrain from disseminating such content. We are not liable for any consequences arising from the spread of harmful information.
132
-
133
- ## Citation
134
-
135
- If you find YuLan-Mini helpful for your research or development, please cite [our technical report](https://arxiv.org/abs/2412.17743):
136
-
137
- ```
138
- @misc{hu2024yulanmini,
139
- title={YuLan-Mini: An Open Data-efficient Language Model},
140
- author={Yiwen Hu and Huatong Song and Jia Deng and Jiapeng Wang and Jie Chen and Kun Zhou and Yutao Zhu and Jinhao Jiang and Zican Dong and Wayne Xin Zhao and Ji-Rong Wen},
141
- year={2024},
142
- eprint={2412.17743},
143
- archivePrefix={arXiv},
144
- primaryClass={cs.CL},
145
- url={https://arxiv.org/abs/2412.17743},
146
- }
147
- ```
148
-
 
 
1
+ ---
2
+ license: mit
3
+ arxiv: 2412.17743
4
+ ---
5
+
6
+ # IMPORTANT NOTICE: THIS IS AN INTERMEDIATE CHECKPOINT, NOT THE FINAL MODEL
7
+
8
+ Both [**YuLan-Mini**](https://huggingface.co/yulan-team/YuLan-Mini) and **YuLan-Mini-Intermediate-4K** were trained starting from this checkpoint.
9
+
10
+ This version includes the optimizer, allowing you to resume training using the Hugging Face Trainer and DeepSpeed Universal Checkpoint.
11
+
12
+ For easier inference and deployment, we merged the re-parameterized added parameters and scaling factors into the final released models ([**YuLan-Mini**](https://huggingface.co/yulan-team/YuLan-Mini) and **YuLan-Mini-Intermediate-4K**), enabling it to run on the Llama architecture. However, these parameters are still retained in the intermediate checkpoints from the training process.
13
+
14
+ ## What you can do with these pre-training resources
15
+
16
+ 1. **Pre-train** your own LLM. You can use [our data](https://huggingface.co/yulan-team/YuLan-Mini-Datasets) and curriculum to train a model that's just as powerful as YuLan-Mini.
17
+ 2. Perform your own **learning rate annealing**. During the annealing phase, YuLan-Mini's learning ability is at its peak. You can resume training from [the checkpoint before annealing](https://huggingface.co/yulan-team/YuLan-Mini-Before-Annealing) and use your own dataset for learning rate annealing.
18
+ 3. **Fine-tune** the Instruct version of the LLM. You can use the YuLan-Mini base model to train your own Instruct version.
19
+ 4. **Training dynamics** research. You can use YuLan-Mini's intermediate checkpoints to explore internal changes during the pre-training process.
20
+ 5. **Synthesize** your own data. You can use YuLan-Mini's [data pipeline](https://github.com/RUC-GSAI/YuLan-Mini) to clean and generate your own dataset.
21
+
22
+
23
+ ## Continual Training Tutorial
24
+
25
+ ### Step 1: Modify the `config.json`
26
+
27
+ Due to the implementation of Hugging Face Trainer, certain parameters are stored in the `config.json` file and cannot be modified through the Trainer's command-line arguments. Therefore, you need to update these parameters in the `config.json` file first, particularly:
28
+
29
+ - **`save_steps`**: The frequency of saving intermediate checkpoints.
30
+ - **`train_batch_size`**: The batch size per GPU (equivalent to `per_device_train_batch_size` in the Trainer). We used a batch size of 1008 (approximately 4M tokens) during the stable training stage. Maintaining this same batch size is equally important for training effectiveness.
31
+
32
+ Below is an example of a properly configured `config.json` file:
33
+
34
+ ```json
35
+ {
36
+ "best_metric": null,
37
+ "best_model_checkpoint": null,
38
+ "epoch": 0.0,
39
+ "eval_steps": 500,
40
+ "global_step": 0,
41
+ "is_hyper_param_search": false,
42
+ "is_local_process_zero": true,
43
+ "is_world_process_zero": true,
44
+ "log_history": [],
45
+ "logging_steps": 3,
46
+ "max_steps": 0,
47
+ "num_input_tokens_seen": 0,
48
+ "num_train_epochs": 0,
49
+ "save_steps": 250,
50
+ "stateful_callbacks": {
51
+ "TrainerControl": {
52
+ "args": {
53
+ "should_epoch_stop": false,
54
+ "should_evaluate": false,
55
+ "should_log": false,
56
+ "should_save": true,
57
+ "should_training_stop": true
58
+ },
59
+ "attributes": {}
60
+ }
61
+ },
62
+ "total_flos": 0,
63
+ "train_batch_size": 3,
64
+ "trial_name": null,
65
+ "trial_params": null
66
+ }
67
+ ```
68
+
69
+ ### Step 2: Enable Universal Checkpointing in the DeepSpeed Configuration
70
+
71
+ To ensure DeepSpeed Integration loads the Universal Checkpoint, you need to enable this feature in the DeepSpeed configuration JSON file.
72
+
73
+ Here is an example of a ZeRO2 configuration with Universal Checkpointing enabled:
74
+
75
+ ```json
76
+ {
77
+ "bf16": {
78
+ "enabled": "auto"
79
+ },
80
+ "zero_optimization": {
81
+ "stage": 2,
82
+ "allgather_partitions": true,
83
+ "allgather_bucket_size": 8e8,
84
+ "overlap_comm": true,
85
+ "reduce_scatter": true,
86
+ "reduce_bucket_size": 8e8,
87
+ "contiguous_gradients": true
88
+ },
89
+ "gradient_accumulation_steps": "auto",
90
+ "gradient_clipping": "auto",
91
+ "steps_per_print": 16,
92
+ "train_batch_size": "auto",
93
+ "train_micro_batch_size_per_gpu": "auto",
94
+ "wall_clock_breakdown": false,
95
+ "dump_state": true,
96
+ "optimizer": {
97
+ "type": "AdamW",
98
+ "params": {
99
+ "lr": "auto",
100
+ "betas": "auto",
101
+ "eps": "auto",
102
+ "weight_decay": "auto"
103
+ }
104
+ },
105
+ "checkpoint": {
106
+ "load_universal": true
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Step 3: Resume Training
112
+
113
+ When calling `trainer.train`, include the `resume_from_checkpoint` argument to load the distributed optimizer state from the Universal Checkpoint and resume training.
114
+
115
+ ```python
116
+ trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint)
117
+ ```
118
+
119
+ We provide an internal [training framework](https://github.com/RUC-GSAI/YuLan-Mini/tree/main/pretrain) for your reference, but you are free to choose other frameworks.
120
+
121
+
122
+ ---
123
+
124
+ ## The Team
125
+
126
+ YuLan-Mini is developed and maintained by [AI Box, Renmin University of China](http://aibox.ruc.edu.cn/).
127
+
128
+ ## License
129
+
130
+ - The code in this repository is released under the [MIT License](./LICENSE).
131
+ - Policies regarding the use of model weights, intermediate optimizer states, and training data will be announced in future updates.
132
+ - Limitations: Despite our efforts to mitigate safety concerns and encourage the generation of ethical and lawful text, the probabilistic nature of language models may still lead to unexpected outputs. For instance, responses might contain bias, discrimination, or other harmful content. Please refrain from disseminating such content. We are not liable for any consequences arising from the spread of harmful information.
133
+
134
+ ## Citation
135
+
136
+ If you find YuLan-Mini helpful for your research or development, please cite [our technical report](https://arxiv.org/abs/2412.17743):
137
+
138
+ ```
139
+ @misc{hu2024yulanmini,
140
+ title={YuLan-Mini: An Open Data-efficient Language Model},
141
+ author={Yiwen Hu and Huatong Song and Jia Deng and Jiapeng Wang and Jie Chen and Kun Zhou and Yutao Zhu and Jinhao Jiang and Zican Dong and Wayne Xin Zhao and Ji-Rong Wen},
142
+ year={2024},
143
+ eprint={2412.17743},
144
+ archivePrefix={arXiv},
145
+ primaryClass={cs.CL},
146
+ url={https://arxiv.org/abs/2412.17743},
147
+ }
148
+ ```
149
+