llm-book/JGLUE
Updated • 580 • 15
How to use llm-book/bert-base-japanese-v3-marc_ja 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-marc_ja") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("llm-book/bert-base-japanese-v3-marc_ja")
model = AutoModelForSequenceClassification.from_pretrained("llm-book/bert-base-japanese-v3-marc_ja", device_map="auto")「大規模言語モデル入門」の第5章で紹介している(感情分析)のモデルです。 cl-tohoku/bert-base-japanese-v3をJGLUEのMARC-jaデータセットでファインチューニングして構築されています。
from transformers import pipeline
text_classification_pipeline = pipeline(model="llm-book/bert-base-japanese-v3-marc_ja")
print(text_classification_pipeline("世界には言葉がわからなくても感動する音楽がある。")[0])
# {'label': 'positive', 'score': 0.9993619322776794}