Issue Encountered While Running Sample Fine-tuning Code

#10
by dauvannam321 - opened

Hi teams,

First of all, thank you for providing this great source code! I truly appreciate the effort you've put into it.

While running the sample fine-tuning code for test sample and inference, I encountered the following error:

Setting `pad_token_id` to `eos_token_id`:151645 for open-end generation.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-33-4d811a21c57d> in <cell line: 0>()
     14     question = '<image>\nTrích xuất thông tin hoá đơn trong ảnh.'
     15 
---> 16     response = model.chat(tokenizer, pixel_values, question, generation_config)
     17     print(f'User: {question}\nAssistant: {response}')
     18     print("="*30)

5 frames
/usr/local/lib/python3.11/dist-packages/transformers/generation/utils.py in _beam_search(self, input_ids, beam_scorer, logits_processor, stopping_criteria, generation_config, synced_gpus, **model_kwargs)
   3501 
   3502             else:  # Unchanged original behavior
-> 3503                 outputs = self(**model_inputs, return_dict=True)
   3504 
   3505             # synced_gpus: don't waste resources running the code we don't need; kwargs must be updated before skipping

TypeError: Qwen2ForCausalLM(
  (model): Qwen2Model(
    (embed_tokens): Embedding(151655, 896)
    (layers): ModuleList(
      (0-23): 24 x Qwen2DecoderLayer(
        (self_attn): Qwen2SdpaAttention(
          (q_proj): Linear(in_features=896, out_features=896, bias=True)
          (k_proj): Linear(in_features=896, out_features=128, bias=True)
          (v_proj): Linear(in_features=896, out_features=128, bias=True)
          (o_proj): Linear(in_features=896, out_features=896, bias=False)
          (rotary_emb): Qwen2RotaryEmbedding()
        )
        (mlp): Qwen2MLP(
          (gate_proj): Linear(in_features=896, out_features=4864, bias=False)
          (up_proj): Linear(in_features=896, out_features=4864, bias=False)
          (down_proj): Linear(in_features=4864, out_features=896, bias=False)
          (act_fn): SiLU()
        )
        (input_layernorm): Qwen2RMSNorm((896,), eps=1e-06)
        (post_attention_layernorm): Qwen2RMSNorm((896,), eps=1e-06)
      )
    )
    (norm): Qwen2RMSNorm((896,), eps=1e-06)
    (rotary_emb): Qwen2RotaryEmbedding()
  )
  (lm_head): Linear(in_features=896, out_features=151655, bias=False)
) got multiple values for keyword argument 'return_dict'

Could you please help me understand what might be causing this issue and how to resolve it? Any guidance would be greatly appreciated.

Looking forward to your response. Thanks in advance!

Sign up or log in to comment