🚀 IndicSBERT
このモデルは、10の主要なインド言語のNLIデータセットで学習されたMuRILモデル(google/muril-base-cased)です。
この単一のモデルは、英語、ヒンディー語、マラーティー語、カンナダ語、タミル語、テルグ語、グジャラート語、オリヤー語、パンジャーブ語、マラヤーラム語、ベンガル語に対応しています。
また、このモデルはクロス言語の機能も備えています。
このモデルは、プロジェクトMahaNLPの一部として公開されています:https://github.com/l3cube-pune/MarathiNLP
より良い文の類似度モデル(このモデルのファインチューニング版)はこちらで公開されています:https://huggingface.co/l3cube-pune/indic-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}
}
単一言語のIndic SBERT論文
多言語のIndic SBERT論文
他の単一言語のIndic文BERTモデルは以下の通りです:
マラーティー語SBERT
ヒンディー語SBERT
カンナダ語SBERT
テルグ語SBERT
マラヤーラム語SBERT
タミル語SBERT
グジャラート語SBERT
オリヤー語SBERT
ベンガル語SBERT
パンジャーブ語SBERT
Indic SBERT(多言語)
他の単一言語の類似度モデルは以下の通りです:
マラーティー語類似度
ヒンディー語類似度
カンナダ語類似度
テルグ語類似度
マラヤーラム語類似度
タミル語類似度
グジャラート語類似度
オリヤー語類似度
ベンガル語類似度
パンジャーブ語類似度
Indic類似度(多言語)
🚀 クイックスタート
📦 インストール
sentence-transformersをインストールすると、このモデルを簡単に使用できます。
pip install -U 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)
高度な使用法
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ライセンスの下で公開されています。