Skip to content

Commit 6e2797a

Browse files
committed
Update docs
1 parent a48240f commit 6e2797a

File tree

6 files changed

+36
-61
lines changed

6 files changed

+36
-61
lines changed

Diff for: .pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/fastai/nbdev
3+
rev: 2.2.10
4+
hooks:
5+
- id: nbdev_clean
6+
- id: nbdev_export

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-2024 Scott Chacon and others
1+
Copyright (c) 2024 Yuxuan Tong
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

Diff for: README.md

+13-29
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ For intended contributors, we recommend installing the package with the
170170

171171
``` shell
172172
pip install -e ".[dev]"
173+
pre-commit install
173174
```
174175

175176
### 🔨 Training
@@ -207,10 +208,7 @@ node of 8 A100 GPUs, please run the following command:
207208
bash scripts/train-single-node.sh \
208209
--data_path "hkust-nlp/dart-math-hard" \
209210
--model_path "meta-llama/Meta-Llama-3-8B" \
210-
--lr "5e-5" \
211-
--bs 64 \
212-
--n_grad_acc_steps 1 \
213-
--n_epochs 1 \
211+
--lr "5e-5" --bs 64 --n_grad_acc_steps 1 --n_epochs 1 \
214212
--gpu_ids "0,1,2,3,4,5,6,7" \
215213
--output_dir "models/dart-math-llama3-8b-prop2diff"
216214
```
@@ -229,10 +227,7 @@ your enviroment and then run the following command:
229227
bash scripts/train-multi-node.sh \
230228
--data_path "hkust-nlp/dart-math-hard" \
231229
--model_path "meta-llama/Meta-Llama-3-70B" \
232-
--lr "2e-5" \
233-
--bs 64 \
234-
--n_grad_acc_steps 1 \
235-
--n_epochs 1 \
230+
--lr "2e-5" --bs 64 --n_grad_acc_steps 1 --n_epochs 1 \
236231
--n_nodes 4 \
237232
--output_dir "models/dart-math-llama3-70b-prop2diff"
238233
```
@@ -249,10 +244,7 @@ The off-the-shelf command to train `DART-Math-Llama3-70B-Uniform`
249244
bash scripts/train-multi-node.sh \
250245
--data_path "hkust-nlp/dart-math-uniform" \
251246
--model_path "meta-llama/Meta-Llama-3-70B" \
252-
--lr "2e-5" \
253-
--bs 64 \
254-
--n_grad_acc_steps 1 \
255-
--n_epochs 1 \
247+
--lr "2e-5" --bs 64 --n_grad_acc_steps 1 --n_epochs 1 \
256248
--n_nodes 4 \
257249
--output_dir "models/dart-math-llama3-70b-prop2diff"
258250
```
@@ -277,17 +269,14 @@ For example, to reproduce one pass of greedy decoding with
277269
0, please run the following command:
278270

279271
``` shell
280-
CUDA_VISIBLE_DEVICES="0" RAY_DEDUP_LOGS=0 python pipeline/gen.py \
272+
CUDA_VISIBLE_DEVICES="0" python pipeline/gen.py \
281273
--gen_save_path "data/res/dart-math-mistral-7b-prop2diff.jsonl" \
282274
--model_name_or_path "hkust-nlp/dart-math-mistral-7b-prop2diff" \
283275
--datasets "math-test" "gsm8k-test" "mwpbench/college-math-test" "deepmind-mathematics" \
284276
"olympiadbench/OE_TO_maths_en_COMP" "theoremqa" \
285-
--max_new_tokens 2048 \
286-
--temperature 0 \
287-
--prompt_template "auto" \
288-
--n_shots -1 \
277+
--max_new_tokens 2048 --temperature 0 --top_p 0.95 \
278+
--prompt_template "cot" --n_shots -1 \
289279
--inf_seed -1 \
290-
--do_eval \
291280
--max_n_trials 1
292281
```
293282

@@ -311,19 +300,14 @@ For example, to reproduce synthesis of `DART-Math-Uniform`, run the
311300
following command with different GPUs, please run the following command:
312301

313302
``` shell
314-
CUDA_VISIBLE_DEVICES="0" RAY_DEDUP_LOGS=0 python pipeline/gen.py \
303+
CUDA_VISIBLE_DEVICES="0" python pipeline/gen.py \
315304
--gen_save_path "data/res/dart-math-uniform.jsonl" \
316305
--model_name_or_path "deepseek-ai/deepseek-math-7b-rl" \
317306
--datasets "math-train" "gsm8k-train" \
318-
--max_new_tokens 2048 \
319-
--temperature 1.6 \
320-
--top_p 0.95 \
321-
--prompt_template "auto" \
322-
--n_shots 0 \
307+
--max_new_tokens 2048 --temperature 1.6 --top_p 0.95 \
308+
--prompt_template "cot" --n_shots 0 \
323309
--inf_seed -1 \
324-
--do_eval \
325-
--min_n_corrects 40 \
326-
--max_n_trials 0 # unlimited, should be killed manually
310+
--min_n_corrects 40 --max_n_trials 0 # unlimited, should be killed manually
327311
```
328312

329313
## [`dart-math` Package](https://hkust-nlp.github.io/dart-math): Efficient and Flexible Training & Inference & Evaluation Pipelines
@@ -336,7 +320,7 @@ website](https://hkust-nlp.github.io/dart-math/quick-start.html).
336320

337321
Thanks to:
338322

339-
- [`nbdev`](https://nbdev.fast.ai/) for genrating the [wonderful
323+
- [`nbdev`](https://nbdev.fast.ai/) for generating the [wonderful
340324
documentation website](https://hkust-nlp.github.io/dart-math),
341325
- [`stanford_alpaca`](https://github.com/tatsu-lab/stanford_alpaca) for
342326
reference code about training,
@@ -352,7 +336,7 @@ paper](https://tongyx361.github.io/assets/dart-math/paper-dart-math.pdf):
352336

353337
``` latex
354338
@article{tong2024dartmath,
355-
author = {Yuxuan Tong, Xiwen Zhang, Rui Wang, Ruidong Wu, Junxian He },
339+
author = {Yuxuan Tong, Xiwen Zhang, Rui Wang, Ruidong Wu, Junxian He},
356340
title = {DART-Math: Difficulty-Aware Rejection Tuning for Mathematical Problem-Solving},
357341
year = {2024},
358342
publisher = {GitHub},

Diff for: nbs/00_quick-start.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"\n",
4141
"```shell\n",
4242
"pip install -e \".[dev]\"\n",
43+
"pre-commit install\n",
4344
"```\n"
4445
]
4546
},
@@ -67,7 +68,7 @@
6768
"from dart_math.train import monkey_patch4pack, make_supervised_dset\n",
6869
"# ...\n",
6970
"monkey_patch4pack(model)\n",
70-
"pack_dset = make_supervised_dset(tokenizer=tokenizer, data_path=data_args.data_path, pack_len=training_args.model_max_length, query_field=data_args.query_field,, resp_field=data_args.resp_field,, prompt_template=data_args.prompt_template)\n",
71+
"pack_dset = make_supervised_dset(tokenizer=tokenizer, data_path=data_args.data_path, pack_len=training_args.model_max_length, query_field=data_args.query_field,, resp_field=data_args.resp_field, prompt_template=data_args.prompt_template)\n",
7172
"trainer = Trainer(model=model, tokenizer=tokenizer, train_dataset=pack_dset)\n",
7273
"# ...\n",
7374
"```\n",

Diff for: nbs/index.ipynb

+13-29
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
"\n",
207207
"```shell\n",
208208
"pip install -e \".[dev]\"\n",
209+
"pre-commit install\n",
209210
"```\n"
210211
]
211212
},
@@ -247,10 +248,7 @@
247248
"bash scripts/train-single-node.sh \\\n",
248249
" --data_path \"hkust-nlp/dart-math-hard\" \\\n",
249250
" --model_path \"meta-llama/Meta-Llama-3-8B\" \\\n",
250-
" --lr \"5e-5\" \\\n",
251-
" --bs 64 \\\n",
252-
" --n_grad_acc_steps 1 \\\n",
253-
" --n_epochs 1 \\\n",
251+
" --lr \"5e-5\" --bs 64 --n_grad_acc_steps 1 --n_epochs 1 \\\n",
254252
" --gpu_ids \"0,1,2,3,4,5,6,7\" \\\n",
255253
" --output_dir \"models/dart-math-llama3-8b-prop2diff\"\n",
256254
"```\n",
@@ -275,10 +273,7 @@
275273
"bash scripts/train-multi-node.sh \\\n",
276274
" --data_path \"hkust-nlp/dart-math-hard\" \\\n",
277275
" --model_path \"meta-llama/Meta-Llama-3-70B\" \\\n",
278-
" --lr \"2e-5\" \\\n",
279-
" --bs 64 \\\n",
280-
" --n_grad_acc_steps 1 \\\n",
281-
" --n_epochs 1 \\\n",
276+
" --lr \"2e-5\" --bs 64 --n_grad_acc_steps 1 --n_epochs 1 \\\n",
282277
" --n_nodes 4 \\\n",
283278
" --output_dir \"models/dart-math-llama3-70b-prop2diff\"\n",
284279
"```\n",
@@ -291,10 +286,7 @@
291286
"bash scripts/train-multi-node.sh \\\n",
292287
" --data_path \"hkust-nlp/dart-math-uniform\" \\\n",
293288
" --model_path \"meta-llama/Meta-Llama-3-70B\" \\\n",
294-
" --lr \"2e-5\" \\\n",
295-
" --bs 64 \\\n",
296-
" --n_grad_acc_steps 1 \\\n",
297-
" --n_epochs 1 \\\n",
289+
" --lr \"2e-5\" --bs 64 --n_grad_acc_steps 1 --n_epochs 1 \\\n",
298290
" --n_nodes 4 \\\n",
299291
" --output_dir \"models/dart-math-llama3-70b-prop2diff\"\n",
300292
"```\n",
@@ -321,17 +313,14 @@
321313
"For example, to reproduce one pass of greedy decoding with `DART-Math-Mistral-7B-Prop2Diff` on the 6 benchmarks in Table 2 on GPU 0, please run the following command:\n",
322314
"\n",
323315
"```shell\n",
324-
"CUDA_VISIBLE_DEVICES=\"0\" RAY_DEDUP_LOGS=0 python pipeline/gen.py \\\n",
316+
"CUDA_VISIBLE_DEVICES=\"0\" python pipeline/gen.py \\\n",
325317
" --gen_save_path \"data/res/dart-math-mistral-7b-prop2diff.jsonl\" \\\n",
326318
" --model_name_or_path \"hkust-nlp/dart-math-mistral-7b-prop2diff\" \\\n",
327319
" --datasets \"math-test\" \"gsm8k-test\" \"mwpbench/college-math-test\" \"deepmind-mathematics\" \\\n",
328320
" \"olympiadbench/OE_TO_maths_en_COMP\" \"theoremqa\" \\\n",
329-
" --max_new_tokens 2048 \\\n",
330-
" --temperature 0 \\\n",
331-
" --prompt_template \"auto\" \\\n",
332-
" --n_shots -1 \\\n",
321+
" --max_new_tokens 2048 --temperature 0 --top_p 0.95 \\\n",
322+
" --prompt_template \"cot\" --n_shots -1 \\\n",
333323
" --inf_seed -1 \\\n",
334-
" --do_eval \\\n",
335324
" --max_n_trials 1\n",
336325
"```\n",
337326
"\n",
@@ -358,19 +347,14 @@
358347
"For example, to reproduce synthesis of `DART-Math-Uniform`, run the following command with different GPUs, please run the following command:\n",
359348
"\n",
360349
"```shell\n",
361-
"CUDA_VISIBLE_DEVICES=\"0\" RAY_DEDUP_LOGS=0 python pipeline/gen.py \\\n",
350+
"CUDA_VISIBLE_DEVICES=\"0\" python pipeline/gen.py \\\n",
362351
" --gen_save_path \"data/res/dart-math-uniform.jsonl\" \\\n",
363352
" --model_name_or_path \"deepseek-ai/deepseek-math-7b-rl\" \\\n",
364353
" --datasets \"math-train\" \"gsm8k-train\" \\\n",
365-
" --max_new_tokens 2048 \\\n",
366-
" --temperature 1.6 \\\n",
367-
" --top_p 0.95 \\\n",
368-
" --prompt_template \"auto\" \\\n",
369-
" --n_shots 0 \\\n",
354+
" --max_new_tokens 2048 --temperature 1.6 --top_p 0.95 \\\n",
355+
" --prompt_template \"cot\" --n_shots 0 \\\n",
370356
" --inf_seed -1 \\\n",
371-
" --do_eval \\\n",
372-
" --min_n_corrects 40 \\\n",
373-
" --max_n_trials 0 # unlimited, should be killed manually\n",
357+
" --min_n_corrects 40 --max_n_trials 0 # unlimited, should be killed manually\n",
374358
"```\n"
375359
]
376360
},
@@ -401,7 +385,7 @@
401385
"source": [
402386
"Thanks to:\n",
403387
"\n",
404-
"- [`nbdev`](https://nbdev.fast.ai/) for genrating the [wonderful documentation website](https://hkust-nlp.github.io/dart-math),\n",
388+
"- [`nbdev`](https://nbdev.fast.ai/) for generating the [wonderful documentation website](https://hkust-nlp.github.io/dart-math),\n",
405389
"- [`stanford_alpaca`](https://github.com/tatsu-lab/stanford_alpaca) for reference code about training,\n",
406390
"- [`functionary`](https://github.com/MeetKai/functionary/tree/main/functionary/train/packing) for reference code about [sequence packing](https://hkust-nlp.github.io/dart-math/train.html#sequence-packing).\n"
407391
]
@@ -421,7 +405,7 @@
421405
"\n",
422406
"```latex\n",
423407
"@article{tong2024dartmath,\n",
424-
" author = {Yuxuan Tong, Xiwen Zhang, Rui Wang, Ruidong Wu, Junxian He },\n",
408+
" author = {Yuxuan Tong, Xiwen Zhang, Rui Wang, Ruidong Wu, Junxian He},\n",
425409
" title = {DART-Math: Difficulty-Aware Rejection Tuning for Mathematical Problem-Solving},\n",
426410
" year = {2024},\n",
427411
" publisher = {GitHub},\n",

Diff for: settings.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ user = hkust-nlp
4040
### Optional ###
4141
requirements = torch transformers datasets accelerate deepspeed triton vllm sympy==1.12 antlr4-python3-runtime==4.11.1 orjson tqdm
4242
# `flash-attn` should be built with `--no-build-isolation`
43-
dev_requirements = black flake8 flake8-bugbear flake8-nb flake8-mutable flake8-builtins flake8-no-implicit-concat flake8-comprehensions notebook ipywidgets nbdev nbconvert
43+
dev_requirements = black flake8 flake8-bugbear flake8-nb flake8-mutable flake8-builtins flake8-no-implicit-concat flake8-comprehensions pre-commit notebook ipywidgets nbdev nbconvert
4444
# console_scripts =

0 commit comments

Comments
 (0)