Skip to content

Light-R1-7B-DS复现问题 #37

@artificialintelligenc

Description

@artificialintelligenc

您好,很强的工作!我们在拜读了技术报告和代码后试图复现Light-R1-7B-DS,但暂未成功。由于代码仓库中貌似并没有直接相关的脚本,我们根据仓库和技术报告进行以下操作,想确认一下正确性和问一些细节问题:

  1. 首先根据论文流程,我们将Light-R1-SFTData中的stage2-3k.json下载并且为了适配下游360-LlaMA-Factory仓库仿照alpaca_en_demo.json将其转化为alpaca格式,并且仿照 "alpaca_en_demo": {"file_name": "alpaca_en_demo.json" }dataset_info.json中进行了注册。
  2. 其次我们根据论文超参数修改了学习率和等效batch sizeImage
  3. 最后,考虑到Light-R1-7B-DS基于DeepSeek-R1-Distill-Qwen-7B微调,我们将template从qwen改为deepseek_r1_distill_qwen。

最终我们使用双卡A800训练脚本如下:

# Light-R1 SFT used a slightly different internal version codebase. This script is the closest counterpart in 360-LLaMA-Factory
# Light-R1 DPO used 360-LLaMA-Factory directly
export DS_SKIP_CUDA_CHECK=1 
export DISABLE_VERSION_CHECK=1  # if necessary
export VLLM_WORKER_MULTIPROC_METHOD=spawn
hostfile="hostfile.12nodes"
deepspeed --include localhost:0,3 --hostfile $hostfile src/train.py \
    --stage sft \
    --do_train \
    --max_steps -1 \
    --model_name_or_path xxx/DeepSeek-R1-Distill-Qwen-7B \
    --template deepseek_r1_distill_qwen \
    --dataset alpaca_formated_lightr1_dataset \
    --preprocessing_num_workers 16 \
    --finetuning_type full \
    --sequence_parallel_size 1 \
    --gradient_checkpointing True \
    --flash_attn fa2  \
    --cache_dir .cache \
    --overwrite_cache \
    --cutoff_len 20000 \
    --output_dir xxx \
    --per_device_train_batch_size 2 \
    --gradient_accumulation_steps 8 \
    --lr_scheduler_type cosine \
    --save_strategy epoch \
    --logging_steps 1 \
    --adam_beta1 0.9 \
    --adam_beta2 0.95 \
    --adam_epsilon 1e-8 \
    --max_grad_norm 1.0 \
    --weight_decay 0.1 \
    --warmup_ratio 0.01 \
    --save_total_limit 10 \
    --learning_rate 5e-6 \
    --save_only_model True \
    --num_train_epochs 10 \
    --bf16 true \
    --plot_loss \
    --seed 42 \
    --do_eval false \
    --deepspeed ./examples/deepspeed/ds_z3_offload_config.json \
    --report_to tensorboard \
    --overwrite_output_dir \
    --ddp_timeout 180000000 \
    --packing True\
    --enable_liger_kernel
# num_train_epochs 100, with simultaneous model selection
# stage1 Light-R1 chose epoch 4


非常想向您确认一下我们修改和复现的细节是否正确,以及想询问一下对于7B模型您是微调了多少个epoch获得论文效果
再次感谢您的工作,非常期待可以得到您的回答,谢谢您!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions