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

Problem with fine-tuning bge-reranker-v2-gemma #1348

Open
Ask-sola opened this issue Jan 21, 2025 · 0 comments
Open

Problem with fine-tuning bge-reranker-v2-gemma #1348

Ask-sola opened this issue Jan 21, 2025 · 0 comments

Comments

@Ask-sola
Copy link

I followed the code below to fine-tune the model:

torchrun --nproc_per_node 2 \
    -m FlagEmbedding.finetune.reranker.decoder_only.base \
    --model_name_or_path BAAI/bge-reranker-v2-gemma \
    --use_lora True \
    --lora_rank 32 \
    --lora_alpha 64 \
    --use_flash_attn True \
    --target_modules q_proj k_proj v_proj o_proj \
    --save_merged_lora_model True \
    --model_type decoder \
    --cache_dir ./cache/model \
    --train_data /root/autodl-tmp/fine_tune_data_train.jsonl \
    --cache_path ./cache/data \
    --train_group_size 8 \
    --query_max_len 512 \
    --passage_max_len 512 \
    --pad_to_multiple_of 8 \
    --knowledge_distillation False \
    --query_instruction_for_rerank 'A: ' \
    --query_instruction_format '{}{}' \
    --passage_instruction_for_rerank 'B: ' \
    --passage_instruction_format '{}{}' \
    --output_dir ./test_decoder_only_base_bge-reranker-v2-minicpm-layerwise \
    --overwrite_output_dir \
    --learning_rate 2e-4 \
    --bf16 \
    --num_train_epochs 20 \
    --per_device_train_batch_size 2 \
    --gradient_accumulation_steps 1 \
    --dataloader_drop_last True \
    --warmup_ratio 0.1 \
    --gradient_checkpointing \
    --weight_decay 0.01 \
    --deepspeed ../ds_stage0.json \
    --logging_steps 1 \
    --save_steps 1000

After obtaining a checkpoint folder, I tried loading the model with the following code:

reranker = FlagLLMReranker('/data1/hya/private/old_book/second/checkpoint-140', cache_dir='/data1/hya/cache')

However, I am unable to load the model and encountered the following error:

Traceback (most recent call last):
  File "/data1/hya/private/old_book/second/GetHardBookPairs.py", line 39, in <module>
    reranker = FlagLLMReranker('/data1/hya/private/old_book/second/checkpoint-140',cache_dir='/data1/hya/cache')
  File "/data1/hya/miniconda3/envs/LLM/lib/python3.10/site-packages/FlagEmbedding/inference/reranker/decoder_only/base.py", line 180, in __init__
    self.model = AutoModelForCausalLM.from_pretrained(
  File "/data1/hya/miniconda3/envs/LLM/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 564, in from_pretrained
    return model_class.from_pretrained(
  File "/data1/hya/miniconda3/envs/LLM/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4041, in from_pretrained
    model.load_adapter(
  File "/data1/hya/miniconda3/envs/LLM/lib/python3.10/site-packages/transformers/integrations/peft.py", line 188, in load_adapter
    peft_config = PeftConfig.from_pretrained(
  File "/data1/hya/miniconda3/envs/LLM/lib/python3.10/site-packages/peft/config.py", line 152, in from_pretrained
    return cls.from_peft_type(**kwargs)
  File "/data1/hya/miniconda3/envs/LLM/lib/python3.10/site-packages/peft/config.py", line 119, in from_peft_type
    return config_cls(**kwargs)
TypeError: LoraConfig.__init__() got an unexpected keyword argument 'eva_config'
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