🚀 ModernPubMedBERT
このモデルは、PubMedデータセットで学習されたsentence-transformersモデルです。Matryoshka Representation Learningを用いて、文章や段落を複数の埋め込み次元(768、512、384、256、128)の密なベクトル空間にマッピングします。これにより、アプリケーションのニーズに応じて異なる埋め込みサイズを柔軟に使用でき、意味的な文章の類似性、意味検索、言い換えマイニング、テキスト分類、クラスタリングなどのタスクで高性能を維持できます。
✨ 主な機能
モデル詳細
属性 |
详情 |
モデルタイプ |
Sentence Transformer |
最大シーケンス長 |
8192トークン |
出力次元数 |
768次元 |
類似度関数 |
コサイン類似度 |
言語 |
en |
ライセンス |
apache-2.0 |
完全なモデルアーキテクチャ
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
📦 インストール
まず、Sentence Transformersライブラリをインストールします。
pip install -U sentence-transformers
💻 使用例
基本的な使用法
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("lokeshch19/ModernPubMedBERT")
sentences = [
"The patient was diagnosed with type 2 diabetes mellitus",
"The individual shows symptoms of hyperglycemia and insulin resistance",
"Metastatic cancer requires aggressive treatment approaches"
]
embeddings = model.encode(sentences)
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
高度な使用法
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
384,
256,
128
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
フレームワークバージョン
属性 |
详情 |
Python |
3.10.10 |
Sentence Transformers |
4.1.0 |
Transformers |
4.51.3 |
PyTorch |
2.7.0+cu128 |
Accelerate |
1.6.0 |
Datasets |
3.5.1 |
Tokenizers |
0.21.1 |
📚 ドキュメント
引用
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
MatryoshkaLoss
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
📄 ライセンス
このモデルは、apache-2.0ライセンスの下で提供されています。