InternLM-XComposer
InternLM-XComposer copied to clipboard
InternLM-XComposer2-VL-7B使用lora微调,似乎保存了整个模型?
我在用lora微调的时候,发现它保存的目录下有一个文件 mp_rank_00_model_states.pt,有32GB,还有一个bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt,有900M。有点困惑,lora应该只保存它训练的那部分参数才对。
我的finetune_lora.sh如下:
#!/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
For unwanted files, you can delete them manually.
For unwanted files, you can delete them manually.
Excuse me, if I only save the parameters corresponding to the adapter (bin file), how should I load the trained model?
For unwanted files, you can delete them manually.
Excuse me, if I only save the parameters corresponding to the adapter (bin file), how should I load the trained model?
See here