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

ValueError: Expected input batch_size (2048) to match target batch_size (16) when I load model from HuggingFace #15

Open
sdey17 opened this issue Feb 14, 2025 · 0 comments

Comments

@sdey17
Copy link

sdey17 commented Feb 14, 2025

Hi,

Thank you for providing such detailed instructions on how to use this model. It has been extremely useful to me. I am relatively new to this field of transformers. I cloned the model from GitHub and was able to run it successfully on my own dataset. However, if I try to load the model from HuggingFace using the following, the code fails and I get an error.

config = AutoConfig.from_pretrained("HUBioDataLab/SELFormer", num_labels=num_labels)
model = AutoModelForMaskedLM.from_pretrained("HUBioDataLab/SELFormer", config=config)
tokenizer = AutoTokenizer.from_pretrained("HUBioDataLab/SELFormer", do_lower_case=False)

The error says ValueError: Expected input batch_size (2048) to match target batch_size (16) and 2048 is 16*128 which is the max_length. I have seen occurrences of such errors and they have been associated with how the loss function is computed. Could you please help me figure out what I am doing wrong here?

Thanks,
Souvik

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