-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
RuntimeError: The size of tensor a (2048) must match the size of tensor b (4241) at non-singleton dimension 1 #1717
Comments
+1
|
Had a similar problem, but it turns out I had to increase max_seq_length in FastLanguageModel.from_pretrained(...) |
+1 |
Apologies is this for normal finetuning or DPO? |
I'm assuming it's something to do with the max sequence length? |
GRPO |
+1, I also got same error,pls help |
Check if your input_ids and attention_mask align:
They should have the same first dimension, e.g., (batch_size, sequence_length). |
+1, pls help |
2 similar comments
+1, pls help |
+1, pls help |
I am getting this error even though the same code was running successfully. Any help, please?
RuntimeError Traceback (most recent call last)
in <cell line: 0>()
12 frames
/usr/local/lib/python3.11/dist-packages/unsloth/models/llama.py in LlamaModel_fast_forward(self, input_ids, causal_mask, attention_mask, position_ids, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict, *args, **kwargs)
701 inputs_embeds.requires_grad_(False)
702 pass
--> 703 inputs_embeds *= attention_mask.unsqueeze(0).transpose(0, 1).transpose(1, 2)
704 if inputs_requires_grad: inputs_embeds.requires_grad_(True)
705 pass
RuntimeError: The size of tensor a (2048) must match the size of tensor b (4241) at non-singleton dimension 1
The text was updated successfully, but these errors were encountered: