LaVIN icon indicating copy to clipboard operation
LaVIN copied to clipboard

目前7B单卡精度略低于论文值,请问可能的原因

Open verigle opened this issue 2 years ago • 2 comments

7B 单卡实验精度 88.58,略低于论文中的结果 89.37

训练参数

CUDA_VISIBLE_DEVICES=0 torchrun --nproc_per_node 1 --master_port 11111 train.py \
    --llm_model 7B\
    --llama_model_path ./data/weights/ \
    --data_root ./data \
    --data_path ./data/alpaca_data.json \
    --caption_file ./data/captions.json \
    --max_seq_len 512 \
    --batch_size 4 \
    --accum_iter 8 \
    --epochs 20 \
    --warmup_epochs 2 \
    --blr 9e-3 \
    --weight_decay 0.02 \
    --output_dir ./data/output/LaVIN-7B/ \
    --log_dir ./data/output/LaVIN-7B/logs/  \
    --adapter_type attn\
    --adapter_dim 8\
    --adapter_scale 1\
    --n_prompt 6 \
    --prompt_format QCM-ALE \
    --temperature 10.\
    --visual_adapter_type router \
    --gradient_checkpointing \
    --cpu_load

请问是和随机数种子有关系?

verigle avatar Sep 06 '23 12:09 verigle

感谢你对我们工作的关注。我们发现代码库版本可能会对结果产生比较明显的影响,请确保pytorch的版本和我们所提供的一致,这样可能有助于更好地复现结果。

luogen1996 avatar Nov 14 '23 07:11 luogen1996

readme 中会要求安装conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 -c pytorch 之后再 pip install -r requirements.txt,我发现 requirements.txt 中 torch 版本是 1.13.0,依照 readme 中顺序安装,最终版本是 1.13.0

我按照步骤安装之后在2卡A100(40G)上跑的结果是 88.26

命令与库中脚本保持一致,除了在 train.py添加 num_workers 4, eval.py 的时候 bs=60(显存限制), CUDA_VISIBLE_DEVICES=0 之外没有做额外改动,请问有什么可能原因导致这个情况?

CUDA_VISIBLE_DEVICES=0,1 torchrun --nproc_per_node 2 --master_port 11111 train.py
--num_workers 4
--llm_model 7B
--llama_model_path ../data/weights/
--data_path ../data/alpaca_data.json
--max_seq_len 512
--batch_size 4
--accum_iter 4
--epochs 20
--warmup_epochs 2
--blr 9e-3
--weight_decay 0.02
--output_dir ./LaVIN-7B/
--adapter_type attn
--adapter_dim 8
--adapter_scale 1
--n_prompt 6
--prompt_format QCM-ALE
--temperature 10.
--visual_adapter_type router

CUDA_VISIBLE_DEVICES=0 torchrun --nproc_per_node 1 --master_port 11111 eval.py
--ckpt_dir ../data/weights/
--llm_model 7B
--tokenizer_path ../data/weights/tokenizer.model
--data_root ../data
--caption_file ../data/captions.json
--adapter_path ./LaVIN-7B/checkpoint-19.pth
--adapter_type attn
--adapter_dim 8
--adapter_scale 1
--prompt_format QCM-ALE
--max_batch_size 60
--max_seq_len 512
--split test
--n_prompt 6
--temperature 10.
--visual_adapter_type router

alphabai avatar Nov 25 '23 11:11 alphabai