🚀 DeCLUTR-sci-base
このモデルは、科学的な文章の類似度を計算するためのもので、科学論文のデータセットを用いて事前学習されています。
🚀 クイックスタート
このモデルは、allenai/scibert_scivocab_uncased モデルをベースに、S2ORC からの200万以上の科学論文を使用して、DeCLUTR: Deep Contrastive Learning for Unsupervised Textual Representations で提示された自己教師付き学習戦略を用いて拡張事前学習されています。
✨ 主な機能
このモデルは、GoogleのUniversal Sentence Encoder や Sentence Transformers と同様に、文章エンコーダとして使用されることを目的としています。特に科学的な文章に適しています。
💻 使用例
基本的な使用法
from scipy.spatial.distance import cosine
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("johngiorgi/declutr-sci-base")
text = [
"Oncogenic KRAS mutations are common in cancer.",
"Notably, c-Raf has recently been found essential for development of K-Ras-driven NSCLCs.",
]
embeddings = model.encode(texts)
semantic_sim = 1 - cosine(embeddings[0], embeddings[1])
🤗 Transformers を使用する場合
import torch
from scipy.spatial.distance import cosine
from transformers import AutoModel, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("johngiorgi/declutr-sci-base")
model = AutoModel.from_pretrained("johngiorgi/declutr-sci-base")
text = [
"Oncogenic KRAS mutations are common in cancer.",
"Notably, c-Raf has recently been found essential for development of K-Ras-driven NSCLCs.",
]
inputs = tokenizer(text, padding=True, truncation=True, return_tensors="pt")
with torch.no_grad():
sequence_output = model(**inputs)[0]
embeddings = torch.sum(
sequence_output * inputs["attention_mask"].unsqueeze(-1), dim=1
) / torch.clamp(torch.sum(inputs["attention_mask"], dim=1, keepdims=True), min=1e-9)
semantic_sim = 1 - cosine(embeddings[0], embeddings[1])
📚 ドキュメント
BibTeXエントリと引用情報
@inproceedings{giorgi-etal-2021-declutr,
title = {{D}e{CLUTR}: Deep Contrastive Learning for Unsupervised Textual Representations},
author = {Giorgi, John and Nitski, Osvald and Wang, Bo and Bader, Gary},
year = 2021,
month = aug,
booktitle = {Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)},
publisher = {Association for Computational Linguistics},
address = {Online},
pages = {879--895},
doi = {10.18653/v1/2021.acl-long.72},
url = {https://aclanthology.org/2021.acl-long.72}
}
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で提供されています。
属性 |
详情 |
パイプラインタグ |
文章類似度 |
タグ |
sentence-transformers、特徴抽出、文章類似度 |
言語 |
英語 |
ライセンス |
Apache-2.0 |
データセット |
s2orc |