deepspeedai / deepspeedai/DeepSpeedExamples

OOM problem when fine-tune reward model with LLaMA in step 2

Open
#521 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

deespeed chat llama
Dominant language
Python
Stars
6.8k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
1

Description

cd training/step2_reward_model_finetuning/
bash training_scripts/single_node/run_llama.sh

run_llama.sh contains

#!/bin/bash
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0

# DeepSpeed Team
OUTPUT=$1
ZERO_STAGE=$2
if [ "$OUTPUT" == "" ]; then
    OUTPUT=./output
fi
if [ "$ZERO_STAGE" == "" ]; then
    ZERO_STAGE=0
fi
mkdir -p $OUTPUT

deepspeed main.py \
   --data_path some_data \
   --data_split 2,4,4 \
   --model_name_or_path path_to_llama \
   --num_padding_at_beginning 1 \
   --per_device_train_batch_size 1 \
   --per_device_eval_batch_size 1 \
   --gradient_checkpointing \
   --max_seq_len 512 \
   --learning_rate 5e-5 \
   --weight_decay 0.1 \
   --num_train_epochs 1 \
   --disable_dropout \
   --gradient_accumulation_steps 1 \
   --lr_scheduler_type cosine \
   --num_warmup_steps 0 \
   --seed 1234 \
   --zero_stage $ZERO_STAGE \
   --deepspeed \
   --output_dir $OUTPUT \
   &> $OUTPUT/training.log

Even if I set the per_device_train_batch_size = 1 and use gradient_checkpointing, I still have an OOM problem. Any solutions?

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

Reproduce the OOM from training/step2_reward_model_finetuning/ using training_scripts/single_node/run_llama.sh, then inspect main.py and the script's DeepSpeed settings. Compare the batch, sequence length, gradient checkpointing, and zero-stage options shown in the issue; the payload does not specify hardware or a confirmed fix, so completion is not clearly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python
Domain
ai, 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.