Support for loading jina-v5-nano retrieval adapter via eland#818
Support for loading jina-v5-nano retrieval adapter via eland#818gregoireco wants to merge 8 commits intomainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…ntegration test - Add _JinaEmbeddingsV5WrapperModule to _TransformerTraceableModel model union type to fix mypy [arg-type] error introduced by our wrapper - Widen _SentenceTransformerWrapperModule.from_pretrained tokenizer param to accept PreTrainedTokenizerFast, fixing mypy [arg-type] at call site - Gate test_jina_v5_import_pytest.py behind TEST_JINA_INTEGRATION=1 env var so the 424 MB HuggingFace model download is skipped in CI by default Made-with: Cursor
These are optional pytorch-extras dependencies not installed in the lint environment, so mypy was failing with import-not-found errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Jina Embeddings v5 is based on EuroBERT, which uses a different architecture from the BERT family: - RoPE (rotary position embeddings) → aten::sin, aten::cos - RMSNorm (instead of LayerNorm) → aten::rsqrt - SiLU activation (instead of GELU) → aten::silu Required for Eland PR elastic/eland#818 which adds support for importing Jina v5 models into Elasticsearch. Made-with: Cursor
edsavage
left a comment
There was a problem hiding this comment.
Just a couple of comments/questions from me.
It's also woth pointing out that, due to the recent pytorch_inference hardening work, these changes now have a dependency on the ml-cpp repo. I've created a draft PR - elastic/ml-cpp#3015 - that adds the new ops to the allowlist. It will need to be merged first.
eland/ml/pytorch/transformers.py
Outdated
| if isinstance(result, (PreTrainedTokenizer, PreTrainedTokenizerFast)): | ||
| tokenizer = result | ||
| except Exception: | ||
| pass |
There was a problem hiding this comment.
We're silently ignoring any exceptions here, should we at least log an error?
eland/ml/pytorch/nlp_ml_model.py
Outdated
| span: t.Optional[int] = None, | ||
| ): | ||
| super().__init__( | ||
| configuration_type="byte_level_bpe", |
There was a problem hiding this comment.
Does byte_level_bpe need ES Java support?
There was a problem hiding this comment.
Actually it's already supported, byte level BPE corresponds to the roberta ES tokenizer config. But I didn't understand that prior to your comment :).
Jina Embeddings v5 is based on EuroBERT, which uses a different architecture from the BERT family: - RoPE (rotary position embeddings) → aten::sin, aten::cos - RMSNorm (instead of LayerNorm) → aten::rsqrt - SiLU activation (instead of GELU) → aten::silu Required for Eland PR elastic/eland#818 which adds support for importing Jina v5 models into Elasticsearch. Made-with: Cursor
No description provided.