🚀 HindSBERT
このモデルは、NLIデータセットで学習されたHindBERTモデル(l3cube - pune/hindi - bert - v2)です。
プロジェクトMahaNLPの一部として公開されています: https://github.com/l3cube - pune/MarathiNLP
主要なインド言語をサポートし、クロスリンガル機能を持つこのモデルの多言語バージョンはこちらで公開されています indic - sentence - bert - nli
より良い文の類似度モデル(このモデルのファインチューニング版)はこちらで公開されています: https://huggingface.co/l3cube - pune/hindi - sentence - similarity - sbert
データセット、モデル、およびベースラインの結果に関する詳細は、当社の論文で確認できます。
🚀 クイックスタート
このモデルは、文や段落を768次元の密ベクトル空間にマッピングし、クラスタリングや意味検索などのタスクに使用できるsentence - transformersモデルです。
✨ 主な機能
- 文や段落を768次元の密ベクトル空間にマッピングします。
- クラスタリングや意味検索などのタスクに使用できます。
📦 インストール
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)
高度な使用法
sentence - transformersを使用せずに、次のようにモデルを使用できます。まず、入力をトランスフォーマーモデルに通し、次にコンテキスト化された単語埋め込みの上に適切なプーリング操作を適用する必要があります。
from transformers import AutoTokenizer, AutoModel
import torch
def cls_pooling(model_output, attention_mask):
return model_output[0][:,0]
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 = cls_pooling(model_output, encoded_input['attention_mask'])
print("Sentence embeddings:")
print(sentence_embeddings)
📚 ドキュメント
関連論文
@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}
}
関連リンク
他の単言語インド語文BERTモデル
- [マラーティ語SBERT](https://huggingface.co/l3cube - pune/marathi - sentence - bert - nli)
- [ヒンディー語SBERT](https://huggingface.co/l3cube - pune/hindi - sentence - bert - nli)
- [カンナダ語SBERT](https://huggingface.co/l3cube - pune/kannada - sentence - bert - nli)
- [テルグ語SBERT](https://huggingface.co/l3cube - pune/telugu - sentence - bert - nli)
- [マラヤーラム語SBERT](https://huggingface.co/l3cube - pune/malayalam - sentence - bert - nli)
- [タミル語SBERT](https://huggingface.co/l3cube - pune/tamil - sentence - bert - nli)
- [グジャラート語SBERT](https://huggingface.co/l3cube - pune/gujarati - sentence - bert - nli)
- [オリヤ語SBERT](https://huggingface.co/l3cube - pune/odia - sentence - bert - nli)
- [ベンガル語SBERT](https://huggingface.co/l3cube - pune/bengali - sentence - bert - nli)
- [パンジャブ語SBERT](https://huggingface.co/l3cube - pune/punjabi - sentence - bert - nli)
- [インド語SBERT(多言語)](https://huggingface.co/l3cube - pune/indic - sentence - bert - nli)
他の単言語類似度モデル
- [マラーティ語類似度](https://huggingface.co/l3cube - pune/marathi - sentence - similarity - sbert)
- [ヒンディー語類似度](https://huggingface.co/l3cube - pune/hindi - sentence - similarity - sbert)
- [カンナダ語類似度](https://huggingface.co/l3cube - pune/kannada - sentence - similarity - sbert)
- [テルグ語類似度](https://huggingface.co/l3cube - pune/telugu - sentence - similarity - sbert)
- [マラヤーラム語類似度](https://huggingface.co/l3cube - pune/malayalam - sentence - similarity - sbert)
- [タミル語類似度](https://huggingface.co/l3cube - pune/tamil - sentence - similarity - sbert)
- [グジャラート語類似度](https://huggingface.co/l3cube - pune/gujarati - sentence - similarity - sbert)
- [オリヤ語類似度](https://huggingface.co/l3cube - pune/odia - sentence - similarity - sbert)
- [ベンガル語類似度](https://huggingface.co/l3cube - pune/bengali - sentence - similarity - sbert)
- [パンジャブ語類似度](https://huggingface.co/l3cube - pune/punjabi - sentence - similarity - sbert)
- [インド語類似度(多言語)](https://huggingface.co/l3cube - pune/indic - sentence - similarity - sbert)
📄 ライセンス
このモデルはcc - by - 4.0ライセンスの下で公開されています。