LoginSignup
0
0

More than 1 year has passed since last update.

自然言語処理モデルBERTの検証(5)-GLUEベンチマーク(その3)

Last updated at Posted at 2022-04-05
[前回] 自然言語処理モデルBERTの検証(4)-GLUEベンチマーク(その2)

はじめに

GLUEタスク検証の続きです。
前回と同じ手順で、一つずつ実行しテスト結果を確認します。

GLUEタスクの種類

  • (済)CoLA: 入力文が英語文法として正しいか判定
  • (済)SST-2: 映画レビューの感情解析(ポジティブ、ネガティブ)
  • (今回)MNLI: 2つの入力文が意味的に含意/矛盾/中立か判定
  • QQP: 2つの質問文の意味が等価か判定
  • QNLI: Q&A
  • STS-B: ニュースの見出し文の類似度を5段階で評定
  • MRPC: 2つの文が等しいか否かを判定
  • RTE: 2つの入力文の含意を判定
  • SQuAD: Q&A
  • NER: 語の役割(人/組織/場所など)を特定
  • SWAG: 入力文に後続する文を4つの選択肢から選ぶ

MNLI: 2つの入力文が意味的に含意/矛盾/中立か判定

自然言語処理モデルBERTの検証(3)-GLUEベンチマーク(その1)の手順で、
下記「GLUEからタスクを選択」を除いては、そのまま実行できます。

手順「GLUEからタスクを選択」のみglue/mnliに変更

ドロップダウンメニューからglue/mnliを選択

image.png

残りの手順もそのまま実行

ファインチューニングに時間かかりました(50分程度)。
テスト結果、

premise   : tf.Tensor([b'Equally important, each area includes a place where, in hallowed and sensible military phrasing, you can go for rest and recreation.'], shape=(1,), dtype=string)
hypothesis: tf.Tensor([b'The areas lack any sort of recreational or resting places.'], shape=(1,), dtype=string)
This premise CONTRADICTS the hypothesis
BERT raw results: tf.Tensor([-4.600829  -2.5035274  5.752845 ], shape=(3,), dtype=float32)

premise   : tf.Tensor([b"'Best case scenario.'"], shape=(1,), dtype=string)
hypothesis: tf.Tensor([b'This went wrong in every way.'], shape=(1,), dtype=string)
This premise CONTRADICTS the hypothesis
BERT raw results: tf.Tensor([-3.9747162  -0.77916163  4.6576896 ], shape=(3,), dtype=float32)

premise   : tf.Tensor([b'The strong regional identity of the south has repeatedly foiled attempts to spread Hindi and make it the national language here.'], shape=(1,), dtype=string)
hypothesis: tf.Tensor([b'The south supported Hindi as the national language.'], shape=(1,), dtype=string)
This premise CONTRADICTS the hypothesis
BERT raw results: tf.Tensor([-2.2312791 -1.5064766  3.6466644], shape=(3,), dtype=float32)

premise   : tf.Tensor([b'White has none of these things.'], shape=(1,), dtype=string)
hypothesis: tf.Tensor([b'White had every single thing.'], shape=(1,), dtype=string)
This premise CONTRADICTS the hypothesis
BERT raw results: tf.Tensor([-3.4551892 -2.157375   4.804791 ], shape=(3,), dtype=float32)

premise   : tf.Tensor([b'However, attitudes have changed, and diving is now a legal and welcomed activity, provided you dive with an approved and registered organization.'], shape=(1,), dtype=string)
hypothesis: tf.Tensor([b'Because of a change in attitudes, everyone welcomes diving.'], shape=(1,), dtype=string)
This premise ENTAILS the hypothesis
BERT raw results: tf.Tensor([ 1.8908477  0.9796005 -2.2114544], shape=(3,), dtype=float32)

2つの入力文が意味的に、含意(ENTAIL)/矛盾(CONTRADICT)/中立(NEUTRAL)、
か判定してくれました。

おわりに

他のタスクも同じ要領で実行中で、次回結果共有いたします。
お楽しみに。

[次回] 自然言語処理モデルBERTの検証(6)-GLUEベンチマーク(その4)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0