conda create -n tad python=3.10 -y
conda activate tad
pip install -r requirements.txtFor LLaDA:
python prepare/llada_gen_math_traj.py \
--model_name <your_llada_model_path> \
--output_path data/llada_math_traj.jsonl \
--dataset_name gsm8k \
--dataset_split train \
--max_new_tokens 256 \
--steps 256 \
--block_length 32 \
--num_samples 1 \
--limit 0For Dream:
python prepare/dream_gen_math_traj.py \
--model_name <your_dream_model_path> \
--output_path data/dream_math_traj.jsonl \
--dataset_name gsm8k \
--dataset_split train \
--max_new_tokens 256 \
--block_length 32 \
--top_p 0.95 \
--alg entropy \
--num_samples 1 \
--limit 0For LLaDA:
python prepare/llada_gen_code_traj.py \
--model_name <your_llada_model_path> \
--parquet_path <path_to_kodcode_parquet> \
--output_path data/llada_code_traj.jsonl \
--max_new_tokens 256 \
--steps 256 \
--block_length 32 \
--num_samples 1 \For Dream:
python prepare/dream_gen_code_traj.py \
--model_name <your_dream_model_path> \
--parquet_path <path_to_kodcode_parquet> \
--output_path data/dream_code_traj.jsonl \
--max_new_tokens 256 \
--block_length 32 \
--top_p 0.95 \
--alg entropy \
--num_samples 1 \Edit the config file to set your model path and training hyperparameters:
- LLaDA:
LLaDA/configs/config_llada.yaml - Dream:
Dream/configs/config_dream.yaml
Train LLaDA:
cd LLaDA
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 deepspeed train_llada.pyTrain Dream:
cd Dream
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 deepspeed train_dream.pyAfter training, merge the LoRA adapter into the base model. Edit the paths in merge_lora.py and run:
For LLaDA:
cd LLaDA
# Edit merge_lora.py:
# - name = "<your_base_model_path>"
# - PeftModel.from_pretrained(base_model, "<your_checkpoint_path>")
# - merged_model.save_pretrained("<save_path>")
python merge_lora.pyEdit the model_path variable in the evaluation script to point to your merged model, then run:
Evaluate LLaDA:
cd eval
# Edit eval_llada.sh: set model_path="<your_merged_model_path>"
bash eval_llada.shThe evaluation scripts cover the following benchmarks:
- Math: GSM8K, MATH (Minerva)
- Code: HumanEval, MBPP
Results will be saved under evals_results/.
This project builds upon excellent open-source work:
