Downloads · 30 days
167
22% of all-time downloads
slone/bert-base-multilingual-cased-bak-rus-similarity
bert-base-multilingual-cased-bak-rus-similarity is a text classification model from slone. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This is a text pair classifier, trained to predict whether a Bashkir sentence and a Russian sentence have the same meaning.
Downloads · 30 days
167
22% of all-time downloads
All-time downloads
767
Public
Parameters
178M
1.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin711 MB · 50%
How the weights are stored.
F32178M · 100%
From the Hugging Face model README
This is a text pair classifier, trained to predict whether a Bashkir sentence and a Russian sentence have the same meaning.
It can be used for filtering parallel corpora or evaluating machine translation quality.
It can be applied to predict scores like this:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
clf_name = 'slone/bert-base-multilingual-cased-bak-rus-similarity'
clf = AutoModelForSequenceClassification.from_pretrained(clf_name)
clf_tokenizer = AutoTokenizer.from_pretrained(clf_name)
def classify(texts_ba, texts_ru):
with torch.inference_mode():
batch = clf_tokenizer(texts_ba, texts_ru, padding=True, truncation=True, max_length=512, return_tensors='pt').to(clf.device)
return torch.softmax(clf(**batch).logits.view(-1, 2), -1)[:, 1].cpu().numpy()
print(classify(['Сәләм, ғаләм!', 'Хәйерле көн, тыныслыҡ.'], ['Привет, мир!', 'Мама мыла раму.']))
# [0.96345973 0.02213471]
For most "good" sentence pairs, these scores are above 0.5.