InternLM / InternLM/InternLM-XComposer

InternLM-XComposer2-VL-7B使用lora微调,似乎保存了整个模型?

Open
#204 3 comments 0 reactions 1 assignee Assigned to @yuhangzang View on GitHub
Dominant language
Python
Stars
2.9k
Forks
175
PR merge metrics
No merged PRs in 30d

Description

我在用lora微调的时候,发现它保存的目录下有一个文件 mp_rank_00_model_states.pt,有32GB,还有一个bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt,有900M。有点困惑,lora应该只保存它训练的那部分参数才对。

我的finetune_lora.sh如下:

```shell
#!/bin/bash
export CUDA_DEVICE_MAX_CONNECTIONS=1
DIR=`pwd`

export MODEL="/root/onethingai-tmp/Shanghai_AI_Laboratory/internlm-xcomposer2-vl-7b"

export DATA="finetune/data.txt"

GPUS_PER_NODE=1
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 \
--img_size 490 \
--given_num True \
--bf16 True \
--fix_vit True \
--fix_sampler True \
--use_lora True \
--output_dir output/3_4_single_422_internlm \
--num_train_epochs 20 \
--batch_size 1 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--gradient_accumulation_steps 8 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 400 \
--save_total_limit 10 \
--learning_rate 5e-5 \
--weight_decay 0.1 \
--adam_beta2 0.95 \
--warmup_ratio 0.01 \
--lr_scheduler_type "cosine" \
--logging_steps 10 \
--report_to "none" \
--max_length 4096 \
--deepspeed finetune/ds_config_zero2.json \
--gradient_checkpointing True
```

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.