CoolFace
Modelpublic

krutrim-ai-labs/Vyakyarth

sourceHugging Faceotherupdated 2y agoView on Hugging Face
15likes11kdownloads
Model Card

Vyakyarth: A Multilingual Sentence Embedding Model for Indic Languages

![Static Badge](https://huggingface.co/krutrim-ai-labs/vyakyarth) ![Static Badge](https://github.com/ola-krutrim/Vyakyarth) ![Static Badge](https://cloud.olakrutrim.com/console/inference-service?section=models&modelName=Krutrim&artifactName=Vyakyarth&artifactType=model) ![Static Badge](https://ai-labs.olakrutrim.com/models/Vyakyarth-1-Indic-Embedding)

This is a sentence-transformers model finetuned from sentence-transformers/stsb-xlm-r-multilingual. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

![Vyakyarth](https://www.youtube.com/watch?v=N1f8IlZCUi4)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np


# Download from the 🤗 Hub
model = SentenceTransformer("krutrim-ai-labs/vyakyarth")
# Run inference
sentences = ["मैं अपने दोस्त से मिला", "I met my friend", "I love you"
]
embeddings = np.array(model.encode(sentences))

print(cosine_similarity([embeddings[0]], [embeddings[1]])[0][0])
# Score : 0.9861017

print(cosine_similarity([embeddings[0]], [embeddings[2]])[0][0])
# Score 0.26329127

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Evaluation/Benchmarking

Dataset Name : Flores Cross Lingual Sentence Retrieval Task of IndicXtreme Benchmark

**Language****MuRIL****IndicBERT****Vyakyarth****jina-embeddings-v3**
Bengali77.091.098.797.4
Gujarati67.092.498.797.3
Hindi84.290.599.998.8
Kannada88.489.199.296.8
Malayalam82.289.298.796.3
Marathi83.992.598.897.1
Sanskrit36.430.490.184.1
Tamil79.490.097.995.8
Telugu43.588.697.597.3
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)

License

This code repository and the model weights are licensed under the Krutrim Community License.

7. Citation

@inproceedings{
  author={Pushkar Singh, Sandeep Kumar Pandey, Rajkiran Panuganti},
  title={Vyakyarth: A Multilingual Sentence Embedding Model for Indic Languages},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/ola-krutrim/Vyakyarth}}
}

Contact

Contributions are welcome! If you have any improvements or suggestions, feel free to submit a pull request on GitHub.