Downloads · 30 days
17K
0% of all-time downloads
cointegrated/LaBSE-en-ru
LaBSE-en-ru is a feature extraction model from cointegrated. Use it when you need embeddings to search or compare text. It is set up for transformers.
This is a truncated version of sentence-transformers/LaBSE, which is, in turn, a port of LaBSE by Google.
Downloads · 30 days
17K
0% of all-time downloads
All-time downloads
15M
Public
Parameters
129M
1.7 GB on disk
Likes
60
Public
Click a slice to open those files.
.h5687 MB · 40%
How the weights are stored.
F32129M · 100%
From the Hugging Face model README
This is a truncated version of sentence-transformers/LaBSE, which is, in turn, a port of LaBSE by Google.
The current model has only English and Russian tokens left in the vocabulary. Thus, the vocabulary is 10% of the original, and number of parameters in the whole model is 27% of the original, without any loss in the quality of English and Russian embeddings.
To get the sentence embeddings, you can use the following code:
import torch
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("cointegrated/LaBSE-en-ru")
model = AutoModel.from_pretrained("cointegrated/LaBSE-en-ru")
sentences = ["Hello World", "Привет Мир"]
encoded_input = tokenizer(sentences, padding=True, truncation=True, max_length=64, return_tensors='pt')
with torch.no_grad():
model_output = model(**encoded_input)
embeddings = model_output.pooler_output
embeddings = torch.nn.functional.normalize(embeddings)
print(embeddings)
The model has been truncated in this notebook. You can adapt it for other languages (like EIStakovskii/LaBSE-fr-de), models or datasets.
Fangxiaoyu Feng, Yinfei Yang, Daniel Cer, Narveen Ari, Wei Wang. Language-agnostic BERT Sentence Embedding. July 2020
License: https://tfhub.dev/google/LaBSE/1