Problem
TextEmbedder::from_pretrained_hf in rust/src/embeddings/embed/text.rs only routes ModernBertForMaskedLM to ModernBertEmbedder:
"ModernBertForMaskedLM" => Ok(Self::ModernBert(Box::new(ModernBertEmbedder::new(...)?))),
Many embedding models on Hugging Face use architecture ModernBertModel, not ModernBertForMaskedLM, for example:
ibm-granite/granite-embedding-97m-multilingual-r2
Alibaba-NLP/gte-modernbert-base
nomic-ai/modernbert-embed-base
Calling TextEmbedder::from_pretrained_hf with these models fails with "Model not supported", even though ModernBertEmbedder::new(model_id, ...) works when used directly.
Expected behavior
Also match ModernBertModel and construct ModernBertEmbedder the same way.
Workaround
Instantiate ModernBertEmbedder directly instead of going through TextEmbedder.
Problem
TextEmbedder::from_pretrained_hfinrust/src/embeddings/embed/text.rsonly routesModernBertForMaskedLMtoModernBertEmbedder:"ModernBertForMaskedLM" => Ok(Self::ModernBert(Box::new(ModernBertEmbedder::new(...)?))),Many embedding models on Hugging Face use architecture
ModernBertModel, notModernBertForMaskedLM, for example:ibm-granite/granite-embedding-97m-multilingual-r2Alibaba-NLP/gte-modernbert-basenomic-ai/modernbert-embed-baseCalling
TextEmbedder::from_pretrained_hfwith these models fails with"Model not supported", even thoughModernBertEmbedder::new(model_id, ...)works when used directly.Expected behavior
Also match
ModernBertModeland constructModernBertEmbedderthe same way.Workaround
Instantiate
ModernBertEmbedderdirectly instead of going throughTextEmbedder.