Downloads · 30 days
205
0% of all-time downloads
llm-book/bert-base-japanese-v3-unsup-simcse-jawiki
bert-base-japanese-v3-unsup-simcse-jawiki is a feature extraction model from llm-book. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as apache-2.0.
「大規模言語モデル入門」の第8章で紹介している教師なしSimCSEのモデルです。 cl-tohoku/bert-base-japanese-v3 を llm-book/jawiki-sentences でファインチューニングして構築されています。
Downloads · 30 days
205
0% of all-time downloads
All-time downloads
45.1K
Public
Repo size
890 MB
Likes
3
Public
Click a slice to open those files.
.bin445 MB · 100%
From the Hugging Face model README
「大規模言語モデル入門」の第8章で紹介している教師なしSimCSEのモデルです。 cl-tohoku/bert-base-japanese-v3 を llm-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