--- license: mit language: ja library_name: transformers tags: - pytorch - deberta - deberta-v2 - commonsenseqa - commonsense_qa - commonsense-qa - CommonsenseQA datasets: - wikipedia - cc100 - oscar metrics: - accuracy --- # このモデルはdeberta-v2-base-japaneseをファインチューニングしてCommonsenseQA(選択式の質問)に用いれるようにしたものです。 このモデルはdeberta-v2-base-japaneseをyahoo japan/JGLUEのJCommonsenseQA( https://github.com/yahoojapan/JGLUE ) を用いてファインチューニングしたものです。 # This model is fine-tuned model for CommonsenseQA which is based on deberta-v2-base-japanese This model is fine-tuned by using JGLUE/JCommonsenseQA dataset. You could use this model for CommonsenseQA tasks. # How to use 使い方 transformersおよびpytorch、sentencepiece、Juman++をインストールしてください。 以下のコードを実行することで、CommonsenseQAタスクを解かせることができます。 please execute this code. ```python from transformers import AutoTokenizer, AutoModelForMultipleChoice import torch import numpy as np # modelのロード tokenizer = AutoTokenizer.from_pretrained('Mizuiro-sakura/deberta-v2-japanese-base-finetuned-commonsenseqa') model = AutoModelForMultipleChoice.from_pretrained('Mizuiro-sakura/deberta-v2-japanese-base-finetuned-commonsenseqa') # 質問と選択肢の代入 question = '電子機器で使用される最も主要な電子回路基板の事をなんと言う?' choice1 = '掲示板' choice2 = 'パソコン' choice3 = 'マザーボード' choice4 = 'ハードディスク' choice5 = 'まな板' # トークン化(エンコーディング・形態素解析)する token = tokenizer([question,question,question,question,question],[choice1,choice2,choice3,choice4,choice5],return_tensors='pt',padding=True) leng=len(token['input_ids'][0]) # modelに入力するための下準備 X1 = np.empty(shape=(1, 5, leng)) X2 = np.empty(shape=(1, 5, leng)) X1[0, :, :] = token['input_ids'] X2[0, :, :] = token['attention_mask'] # modelにトークンを入力する results = model(torch.tensor(X1).to(torch.int64),torch.tensor(X2).to(torch.int64)) # 最も高い値のインデックスを取得する max_result=torch.argmax(results.logits) print(max_result+1) ``` # モデルの精度 accuracy of model 79.80339588918764 (参考 BERT : 72.0, XLM RoBERTa base : 68.7, LUKE : 80.0) # deberta-v2-base-japaneseとは? 日本語Wikipedeia(3.2GB)および、cc100(85GB)、oscar(54GB)を用いて訓練されたモデルです。 京都大学黒橋研究室が公表されました。 # Model description This is a Japanese DeBERTa V2 base model pre-trained on Japanese Wikipedia, the Japanese portion of CC-100, and the Japanese portion of OSCAR. # Acknowledgments 謝辞 モデルを公開してくださった京都大学黒橋研究室には感謝いたします。 I would like to thank Kurohashi Lab at Kyoto University.