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

Doesnt recognize model type 'modernbert' #2149

Closed
2 of 4 tasks
kguruswamy opened this issue Jan 3, 2025 · 1 comment
Closed
2 of 4 tasks

Doesnt recognize model type 'modernbert' #2149

kguruswamy opened this issue Jan 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@kguruswamy
Copy link

System Info

python 3.9.6
optimum==1.23.3
sentence-transformers==3.3.1

Who can help?

@michaelbenayoun

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction (minimal, reproducible, runnable)

I'm running this command to convert a model to onnx:

optimum-cli export onnx --task sentence-similarity --opset 16 --trust-remote-code -m tomaarsen/ModernBERT-base-gooaq modernbert-base-gooaq

I get this error:

ValueError: The checkpoint you are trying to load has model type modernbert but 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.

Expected behavior

Should be able to export to a directory with onnx artifacts

@kguruswamy kguruswamy added the bug Something isn't working label Jan 3, 2025
@echarlaix
Copy link
Collaborator

Hi @kguruswamy, you are getting this issue as it seems you're using a transformers version which doesn't support ModernBert https://github.com/huggingface/transformers/blob/v4.47.1/src/transformers/models/auto/configuration_auto.py#L1039, ModernBert will be supported in the next transformers release (v4.48) in the meantime you can install transformers from source. The ONNX export of ModernBert models will soon be supported in optimum (integration in #2131)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants