lm-sys / lm-sys/FastChat

out ot memory when i use 32GB V100s to fine-tuning Vicuna-7B-v1.5 with Lora

Open
#2,556 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

Here is my Lora fine-tuning script, when `model_max_length=2048` it will be OOM, when setting 1024 it won't, what's the reason for this, I saw other people seem to be able to fine-tune successfully in 2048 case.
```
deepspeed --include localhost:3 --master_port=9901 fastchat/train/train_lora.py \
--model_name_or_path ./models/vicuna-7B \
--lora_r 8 \
--lora_alpha 16 \
--lora_dropout 0.05 \
--data_path ./data/new_sft_train_data.json \
--fp16 True \
--output_dir ./checkpoints \
--num_train_epochs 3 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 5000 \
--save_total_limit 100 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--model_max_length 2048 \
--q_lora True \
--deepspeed playground/deepspeed_config_s2.json

+-------------------------------+----------------------+----------------------+
| 3 Tesla V100S-PCI... Off | 00000000:00:06.0 Off | 0 |
| N/A 30C P0 25W / 250W | 4MiB / 32768MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

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 with fastchat/train/train_lora.py and playground/deepspeed_config_s2.json, then reproduce the command with model_max_length set to 1024 and 2048 on the stated V100 setup. Trace the memory use around the LoRA and QLoRA training path; done means documenting the cause of the 2048 OOM and a verified configuration or code change that permits the larger length.

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.