Edit model card

bert-base-japanese-v3-unsup-simcse-jawiki

大規模言語モデル入門」の第8章で紹介している教師なしSimCSEのモデルです。 cl-tohoku/bert-base-japanese-v3llm-book/jawiki-sentences でファインチューニングして構築されています。

関連リンク

使い方

from torch.nn.functional import cosine_similarity
from transformers import pipeline

sim_enc_pipeline = pipeline(model="llm-book/bert-base-japanese-v3-unsup-simcse-jawiki", task="feature-extraction")

text = "川べりでサーフボードを持った人たちがいます"
sim_text = "サーファーたちが川べりに立っています"

# text と sim_text のベクトルを獲得
text_emb = sim_enc_pipeline(text, return_tensors=True)[0][0]
sim_emb = sim_enc_pipeline(sim_text, return_tensors=True)[0][0]
# text と sim_text の類似度を計算
sim_pair_score = cosine_similarity(text_emb, sim_emb, dim=0)
print(sim_pair_score.item())  # -> 0.8568589687347412

ライセンス

Apache License 2.0

Downloads last month
723
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train llm-book/bert-base-japanese-v3-unsup-simcse-jawiki