lm-sys / lm-sys/FastChat

deepspeed problem with train_lora.py

Open
#3,648 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

Hello, recently I've tried to fine-tune vicuna with train_lora.py and encounterd some error I failed to resolve.
I try the following script

deepspeed $CODE_PATH \
    --model_name_or_path $MODEL_PATH \
    --lora_r 8 \
    --lora_alpha 16 \
    --lora_dropout 0.05 \
    --data_path $DATA_PATH \
    --bf16 True \
    --output_dir $OUTPUT_DIR \
    --num_train_epochs 3 \
    --per_device_train_batch_size 32 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 1200 \
    --save_total_limit 100 \
    --learning_rate 2e-5 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --tf32 True \
    --model_max_length 2048 \
    --q_lora True \
    --deepspeed $DS_PATH \

and the error is as follows:
QQ20241230-151344
I check the previous issues, remove the deepspeed import and modify the error line as issues/1458#issuecomment-1598308288 but still encounter the similar error at line 124 in train_lora.py:
QQ20241230-152031
Obviously it can not be modified in the same way because the trainer has not been announced before line 124 in the function train(), so I wonder if there's any other approach to solve that? Or maybe the version of transformers and deepspeed in my environment is not matched with the current repo?

My Enviroment: transformers==4.47.1 and deepspeed==0.16.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported failure in train_lora.py with transformers 4.47.1, deepspeed 0.16.2, and the supplied command, then inspect the trainer setup around line 124. Compare the behavior with the workaround discussed in issues/1458#issuecomment-1598308288. Done means identifying whether the failure is a code or dependency mismatch and documenting a verified resolution or compatibility requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.