Instructions to use jinaai/jina-embeddings-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jinaai/jina-embeddings-v3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="jinaai/jina-embeddings-v3", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("jinaai/jina-embeddings-v3", trust_remote_code=True, dtype="auto") - sentence-transformers
How to use jinaai/jina-embeddings-v3 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("jinaai/jina-embeddings-v3", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Update custom_st.py to be compatible with Python 3.8
Use the Dict[str, Any] syntax instead of dict[str, Any] for get_config_dict()
@pewh I think this is a bad commit because pretty much nobody uses Python3.8 version anymore. I had an old node which is why, I had raised that issue. Yet, I wanted to understand why sentence transformers was getting that issue and not transformers. Changing this syntax risks of breaking compatibility with recent Python versions.
@sleeping4cat Oh I actually didn't see your issue until now-- I just had the same error. Maybe I'm incorrect but I don't see how it would break functionality with newer Python versions-- the rest of custom_st.py uses the Dict syntax as opposed to dict (e.g., https://huggingface.co/jinaai/jina-embeddings-v3/blob/main/custom_st.py#L127)
@pewh yup! still I don't recommend making the code compatible for an older version of Python that's deprecated for almost all projects across spectrum. I think a better commit would be if you mentioned on the dataset card, Python3.9 and above is required to run this model for sentenceTransformers. that will be more constructive.