InternLM / InternLM/InternLM-XComposer

out of memory when fine-tune the ICX2.5

Open
#399 4 comments 0 reactions 1 assignee Claimed by @yhcao6 View on GitHub
Dominant language
Python
Stars
2.9k
Forks
175
PR merge metrics
No merged PRs in 30d

Description

Following your fine-tune instruction, my finetune.sh is as
```
#!/bin/bash
export CUDA_DEVICE_MAX_CONNECTIONS=1
DIR=`pwd`

export MODEL="./ckpt/internlm-xcomposer2d5-7b"
# export DATA="path of data"
export DATA="data.txt"

GPUS_PER_NODE=4
NNODES=1
NODE_RANK=0
MASTER_ADDR=localhost
MASTER_PORT=6001

DISTRIBUTED_ARGS="
--nproc_per_node $GPUS_PER_NODE \
--nnodes $NNODES \
--node_rank $NODE_RANK \
--master_addr $MASTER_ADDR \
--master_port $MASTER_PORT
"

torchrun $DISTRIBUTED_ARGS ./finetune/finetune.py \
--model_name_or_path $MODEL \
--data_path $DATA \
--given_num True \
--bf16 True \
--fix_vit True \
--fix_sampler False \
--use_lora False \
--hd_num 18 \
--output_dir output/0724/paired_data_ft_fixVIT_bz16 \
--num_train_epochs 1 \
--batch_size 1 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "epoch" \
--save_total_limit 1 \
--learning_rate 1e-5 \
--weight_decay 0.1 \
--adam_beta2 0.95 \
--warmup_ratio 0.01 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--report_to "none" \
--max_length 16384 \
--deepspeed ./finetune/ds_config_zero2.json \
--gradient_checkpointing True
```
All batch sizes are set to 1 and only two images are encoded for each conversation.
I run this shell on 4 A100 with 80G GPU memory, with out of memory in the first iteration.

All packages are same with your env [docs/install.md](https://github.com/InternLM/InternLM-XComposer?tab=readme-ov-file), except torch=2.10 and cuda=12.1.

Any advice for this wired OOD?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.