🚀 MalayalamSBERT
このモデルは、NLIデータセットで学習されたMalayalamBERTモデル(l3cube - pune/malayalam - bert)です。
プロジェクトMahaNLPの一部として公開されています: https://github.com/l3cube - pune/MarathiNLP
主要なインド言語をサポートし、クロスリンガル機能を持つこのモデルの多言語バージョンはこちらにあります indic - sentence - bert - nli
このモデルの微調整版である、より良い文の類似性モデルはこちらに公開されています: https://huggingface.co/l3cube - pune/malayalam - sentence - similarity - sbert
データセット、モデル、ベースラインの結果に関する詳細は、当社の論文で確認できます。
@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}
}
単言語インドSBERT論文
多言語インドSBERT論文
✨ 主な機能
他の単言語インド文SBERTモデルは以下の通りです:
マラーティー語SBERT
ヒンディー語SBERT
カンナダ語SBERT
テルグ語SBERT
マラヤーラム語SBERT
タミル語SBERT
グジャラート語SBERT
オリヤー語SBERT
ベンガル語SBERT
パンジャーブ語SBERT
インドSBERT(多言語)
他の単言語類似性モデルは以下の通りです:
マラーティー語類似性
ヒンディー語類似性
カンナダ語類似性
テルグ語類似性
マラヤーラム語類似性
タミル語類似性
グジャラート語類似性
オリヤー語類似性
ベンガル語類似性
パンジャーブ語類似性
インド類似性(多言語)
📦 インストール
このモデルを使用するには、sentence - transformersをインストールする必要があります。
pip install -U sentence-transformers
💻 使用例
基本的な使用法(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)
高度な使用法(HuggingFace Transformers)
sentence - transformersを使用せずにこのモデルを使用するには、まず入力をトランスフォーマーモデルに渡し、その後、コンテキスト化された単語埋め込みに適切なプーリング操作を適用する必要があります。
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)
📄 ライセンス
このモデルはCC - BY - 4.0ライセンスの下で公開されています。