ЁЯЪА TamilSBERT-STS
This is a TamilSBERT model (l3cube-pune/tamil-sentence-bert-nli
) fine-tuned on the STS dataset. It is released as a part of project MahaNLP: MahaNLP on GitHub. A multilingual version of this model supporting major Indic languages and cross-lingual sentence similarity is available here.
More details on the dataset, models, and baseline results can be found in our paper.
Model Information
Property |
Details |
Pipeline Tag |
sentence-similarity |
Tags |
sentence-transformers, feature-extraction, sentence-similarity, transformers |
License |
cc-by-4.0 |
Language |
ta |
Widget Examples
The widget provides several examples to demonstrate sentence similarity:
- Example 1:
- Source Sentence: "роороХрпНроХро│рпН роХрпБро┤рпБ рокро╛роЯрпБроХро┐ро▒родрпБ"
- Comparison Sentences:
- "роЪро┐ро▓ро░рпН рокро╛роЯрпБроХро┐ро▒ро╛ро░рпНроХро│рпН"
- "роТро░рпБ роЗро│рпИроЮройрпН рокро┐ропро╛ройрпЛ рокро╛роЯрпБроХро┐ро▒ро╛ройрпН"
- "рооройро┐родройрпН роТро░рпБ роХроЯро┐родроорпН роОро┤рпБродрпБроХро┐ро▒ро╛ройрпН"
- Example 2:
- Source Sentence: "роиро╛ропрпН рокрпКроорпНроорпИропрпИ роХрпБро░рпИроХрпНроХро┐ро▒родрпБ"
- Comparison Sentences:
- "роТро░рпБ роиро╛ропрпН роТро░рпБ рокрпКроорпНроорпИропро┐ро▓рпН роХрпБро░рпИроХрпНроХро┐ро▒родрпБ"
- "роТро░рпБ рокрпВройрпИ рокро╛ро▓рпН роХрпБроЯро┐роХрпНроХро┐ро▒родрпБ"
- "роТро░рпБ роиро╛ропрпН роТро░рпБ рокроирпНродрпИродрпН родрпБро░родрпНродрпБроХро┐ро▒родрпБ"
- Example 3:
- Source Sentence: "роиро╛ройрпН роорпБродро▓рпН роорпБро▒рпИропро╛роХ ро╡ро┐рооро╛ройродрпНродро┐ро▓рпН роЕрооро░рпНроирпНродрпЗройрпН"
- Comparison Sentences:
- "роЕродрпБ роОройродрпБ роорпБродро▓рпН ро╡ро┐рооро╛ройрокрпН рокропрогроорпН "
- "роорпБродро▓рпН роорпБро▒рпИропро╛роХ ро░ропро┐ро▓ро┐ро▓рпН роЕрооро░рпНроирпНродрпЗройрпН"
- "рокрпБродро┐роп роЗроЯроЩрпНроХро│рпБроХрпНроХрпБ рокропрогроорпН роЪрпЖропрпНро╡родрпБ роОройроХрпНроХрпБ рооро┐роХро╡рпБроорпН рокро┐роЯро┐роХрпНроХрпБроорпН"
Citations
@article{deode2023l3cube,
title={L3Cube-IndicSBERT: A simple approach for learning cross-lingual sentence representations using multilingual BERT},
author={Deode, Samruddhi and Gadre, Janhavi and Kajale, Aditi and Joshi, Ananya and Joshi, Raviraj},
journal={arXiv preprint arXiv:2304.11434},
year={2023}
}
@article{joshi2022l3cubemahasbert,
title={L3Cube-MahaSBERT and HindSBERT: Sentence BERT Models and Benchmarking BERT Sentence Representations for Hindi and Marathi},
author={Joshi, Ananya and Kajale, Aditi and Gadre, Janhavi and Deode, Samruddhi and Joshi, Raviraj},
journal={arXiv preprint arXiv:2211.11187},
year={2022}
}
Related Papers
Other Similarity Models
Other Monolingual Indic Sentence BERT Models
ЁЯЪА Quick Start
Prerequisites
You need to have sentence-transformers installed to use this model easily. You can install it using the following command:
pip install -U sentence-transformers
ЁЯТ╗ Usage Examples
Basic Usage (Sentence-Transformers)
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer('{MODEL_NAME}')
embeddings = model.encode(sentences)
print(embeddings)
Advanced Usage (HuggingFace Transformers)
Without sentence-transformers
, you can use the model as follows. First, pass your input through the transformer model, then apply the right pooling-operation on top of the contextualized word embeddings.
from transformers import AutoTokenizer, AutoModel
import torch
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0]
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
sentences = ['This is an example sentence', 'Each sentence is converted']
tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
model = AutoModel.from_pretrained('{MODEL_NAME}')
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
with torch.no_grad():
model_output = model(**encoded_input)
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
print("Sentence embeddings:")
print(sentence_embeddings)
ЁЯУД License
This model is released under the cc-by-4.0 license.