Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Model parameters during finetuning (prints me only mm_projector parameters) #1784

Open
daulettoibazar opened this issue Nov 26, 2024 · 0 comments

Comments

@daulettoibazar
Copy link

daulettoibazar commented Nov 26, 2024

Question

Hi @haotian-liu, I am trying to pretrain and finetune llava model on my custom dataset. But during the fine-tuning, when I load projector.bin, LLava model and Image encoder, when i run train.py with following changes, it only prints the weights of projector (no model weight, no image encoder weights):

    total_params = sum(param.numel() for param in model.parameters())
    
    # Total number of trainable parameters
    trainable_params = sum(param.numel() for param in model.parameters() if param.requires_grad)
    
    print(f"Total Parameters: {total_params}")
    print(f"Trainable Parameters: {trainable_params}")
    data_module = make_supervised_data_module(tokenizer=tokenizer,
                                              data_args=data_args)
    trainer = LLaVATrainer(model=model,
                    tokenizer=tokenizer,
                    args=training_args,
                    **data_module)

The output is

Total Parameters: 32000000
Trainable Parameters:32000000

Below is my fine tuning script:

deepspeed LLaVA/llava/train/train_mem.py \
    --deepspeed "LLaVA/scripts/zero3.json" \
    --model_name_or_path "./tmp/model/v1.5_model" \
    --version v1 \
    --freeze_backbone True \
    --data_path "./tmp/data/fv4.json" \
    --image_folder ./tmp/data/images \
    --vision_tower openai/clip-vit-large-patch14-336 \
    --pretrain_mm_mlp_adapter ./tmp/models/v1.5_model/mm_projector.bin \
    --mm_projector_type mlp2x_gelu \
    --mm_vision_select_layer -2 \
    --mm_use_im_start_end False \
    --mm_use_im_patch_token False \
    --image_aspect_ratio pad \
    --group_by_modality_length True \
    --bf16 True \
    --output_dir ./llava-v1.5-13b_fv4 \
    --num_train_epochs 1 \
    --per_device_train_batch_size 8 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 50000 \
    --save_total_limit 1 \
    --learning_rate 2e-5 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --tf32 True \
    --model_max_length 4096 \
    --gradient_checkpointing True \
    --dataloader_num_workers 4 \
    --lazy_preprocess True \
    --report_to wandb

Why other weights are not visible here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant