llm-book/JGLUE
Updated • 447 • 15
How to use llm-book/bert-base-japanese-v3-jsts with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="llm-book/bert-base-japanese-v3-jsts") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("llm-book/bert-base-japanese-v3-jsts")
model = AutoModelForSequenceClassification.from_pretrained("llm-book/bert-base-japanese-v3-jsts")「大規模言語モデル入門」の第5章で紹介している(意味類似度計算)のモデルです。 cl-tohoku/bert-base-japanese-v3をJGLUEのJSTSデータセットでファインチューニングして構築されています。
from transformers import pipeline
text_sim_pipeline = pipeline(
model="llm-book/bert-base-japanese-v3-jsts",
function_to_apply="none",
)
text = "川べりでサーフボードを持った人たちがいます"
sim_text = "サーファーたちが川べりに立っています"
# textとsim_textの類似度を計算
result = text_sim_pipeline({"text": text, "text_pair": sim_text})
print(result["score"])
# 3.5703558921813965