Skip to content

fix: support ModernBertModel architecture - #218

Open
mikemikimike wants to merge 1 commit into
StarlightSearch:mainfrom
mikemikimike:bugfix/214-modernbert-model
Open

fix: support ModernBertModel architecture#218
mikemikimike wants to merge 1 commit into
StarlightSearch:mainfrom
mikemikimike:bugfix/214-modernbert-model

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

Closes #214.

TextEmbedder::from_pretrained_hf rejected Hugging Face checkpoints whose architecture is ModernBertModel, even though the existing ModernBERT embedder supports them directly.

This change routes both ModernBertModel and the existing ModernBertForMaskedLM architecture through the same ModernBertEmbedder construction path. A focused unit test covers both accepted architecture names and confirms unrelated architectures are not matched.

Validation

  • cargo test -p embed_anything supports_modernbert_embedding_architectures --lib — passed (1 test).
  • git diff --check — passed.
  • cargo fmt --all -- --check reports pre-existing formatting differences outside the changed file; rustfmt --edition 2021 rust/src/embeddings/embed/text.rs was applied to the changed file.
  • cargo clippy -p embed_anything --lib --tests -- -D warnings was started in an isolated target directory; compilation was still in progress during handoff on Windows.

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

Successfully merging this pull request may close these issues.

TextEmbedder only handles ModernBertForMaskedLM, not ModernBertModel embedding checkpoints

1 participant