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

The checkpoint you are trying to load has model type modernbert but Transformers does not recognize this architecture #145

Open
ngo010 opened this issue Dec 20, 2024 · 2 comments

Comments

@ngo010
Copy link

ngo010 commented Dec 20, 2024

Hi,

I run the example code:

`from transformers import AutoTokenizer, AutoModelForMaskedLM

model_id = "answerdotai/ModernBERT-base"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(model_id)`

It shows an error:

ValueError: The checkpoint you are trying to load has model type modernbertbut Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.

I have installed the up-to-date version:
Transformers=4.47.1
Flash-attn=2.7.2.post1

Could you please advise how to fix it? Thanks.

@davedgd
Copy link

davedgd commented Dec 20, 2024

You need a newer version of transformers:

pip install git+https://github.com/huggingface/transformers.git

@ngo010
Copy link
Author

ngo010 commented Dec 20, 2024

Thanks. The latest version 4.48.0.dev0 works.

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

2 participants