|
--- |
|
base_model: jinaai/jina-embeddings-v3 |
|
language: |
|
- multilingual |
|
- af |
|
- am |
|
- ar |
|
- as |
|
- az |
|
- be |
|
- bg |
|
- bn |
|
- br |
|
- bs |
|
- ca |
|
- cs |
|
- cy |
|
- da |
|
- de |
|
- el |
|
- en |
|
- eo |
|
- es |
|
- et |
|
- eu |
|
- fa |
|
- fi |
|
- fr |
|
- fy |
|
- ga |
|
- gd |
|
- gl |
|
- gu |
|
- ha |
|
- he |
|
- hi |
|
- hr |
|
- hu |
|
- hy |
|
- id |
|
- is |
|
- it |
|
- ja |
|
- jv |
|
- ka |
|
- kk |
|
- km |
|
- kn |
|
- ko |
|
- ku |
|
- ky |
|
- la |
|
- lo |
|
- lt |
|
- lv |
|
- mg |
|
- mk |
|
- ml |
|
- mn |
|
- mr |
|
- ms |
|
- my |
|
- ne |
|
- nl |
|
- 'no' |
|
- om |
|
- or |
|
- pa |
|
- pl |
|
- ps |
|
- pt |
|
- ro |
|
- ru |
|
- sa |
|
- sd |
|
- si |
|
- sk |
|
- sl |
|
- so |
|
- sq |
|
- sr |
|
- su |
|
- sv |
|
- sw |
|
- ta |
|
- te |
|
- th |
|
- tl |
|
- tr |
|
- ug |
|
- uk |
|
- ur |
|
- uz |
|
- vi |
|
- xh |
|
- yi |
|
- zh |
|
library_name: model2vec |
|
model_name: jina-embeddings-v3-query-distilled |
|
license: cc-by-nc-4.0 |
|
tags: |
|
- embeddings |
|
- static-embeddings |
|
- feature-extraction |
|
- sentence-similarity |
|
- sentence-transformers |
|
--- |
|
|
|
# jina-embeddings-v3-query-distilled Model Card |
|
|
|
This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [jinaai/jina-embeddings-v3](https://huggingface.co/jinaai/jina-embeddings-v3) Sentence Transformer with the `retrieval.query` task LoRA applied. It uses static embeddings, allowing text embeddings to be computed orders of magnitude faster on both GPU and CPU. It is designed for applications where computational resources are limited or where real-time performance is critical. |
|
|
|
|
|
## Installation |
|
|
|
Install model2vec using pip: |
|
``` |
|
pip install model2vec |
|
``` |
|
|
|
## Usage |
|
Load this model using the `from_pretrained` method: |
|
```python |
|
from model2vec import StaticModel |
|
|
|
# Load a pretrained Model2Vec model |
|
model = StaticModel.from_pretrained("CISCai/jina-embeddings-v3-query-distilled") |
|
|
|
# Compute text embeddings |
|
embeddings = model.encode(["Example sentence"]) |
|
``` |
|
|
|
The following code snippet shows how to load a Model2Vec model into a Sentence Transformer model: |
|
```python |
|
from sentence_transformers import SentenceTransformer |
|
from sentence_transformers.models import StaticEmbedding |
|
|
|
# Initialize a StaticEmbedding module |
|
static_embedding = StaticEmbedding.from_model2vec("CISCai/jina-embeddings-v3-query-distilled") |
|
model = SentenceTransformer(modules=[static_embedding]) |
|
embeddings = model.encode(["Example sentence"]) |
|
``` |
|
|
|
Alternatively, you can distill your own model using the `distill` method: |
|
```python |
|
from model2vec.distill import distill |
|
|
|
# Choose a Sentence Transformer model |
|
model_name = "BAAI/bge-base-en-v1.5" |
|
|
|
# Distill the model |
|
m2v_model = distill(model_name=model_name, pca_dims=256) |
|
|
|
# Save the model |
|
m2v_model.save_pretrained("m2v_model") |
|
``` |
|
|
|
## How it works |
|
|
|
Model2vec creates a small, fast, and powerful model that outperforms other static embedding models by a large margin on all tasks we could find, while being much faster to create than traditional static embedding models such as GloVe. Best of all, you don't need any data to distill a model using Model2Vec. |
|
|
|
It works by passing a vocabulary through a sentence transformer model, then reducing the dimensionality of the resulting embeddings using PCA, and finally weighting the embeddings using zipf weighting. During inference, we simply take the mean of all token embeddings occurring in a sentence. |
|
|
|
## Additional Resources |
|
|
|
- [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec) |
|
- [Model2Vec Repo](https://github.com/MinishLab/model2vec) |
|
- [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results) |
|
- [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials) |
|
|
|
## Library Authors |
|
|
|
Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team consisting of [Stephan Tulkens](https://github.com/stephantul) and [Thomas van Dongen](https://github.com/Pringled). |
|
|
|
## Citation |
|
|
|
Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work. |
|
``` |
|
@software{minishlab2024model2vec, |
|
authors = {Stephan Tulkens, Thomas van Dongen}, |
|
title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model}, |
|
year = {2024}, |
|
url = {https://github.com/MinishLab/model2vec}, |
|
} |
|
``` |