第16章自然言語処理:応用
16.7. Natural Language Inference: Fine-Tuning BERT16.7 自然言語推論:BERTを微調整する
In earlier sections of this chapter, we have designed an attention-based architecture (in Section 16.5) for the natural language inference task on the SNLI dataset (as described in Section 16.4). Now we revisit this task by fine-tuning BERT. As discussed in Section 16.6, natural language inference is a sequence-level text pair classification problem, and fine-tuning BERT only requires an additional MLP-based architecture, as illustrated in Fig. 16.7.1.
英語のヒント
Fig. 16.7.1図16.7.1
This section feeds pretrained BERT to an MLP-based architecture for natural language inference.
英語のヒント
この節では、事前学習したBERTを、自然言語推論のためのMLPにもとづくアーキテクチャに入れる。
In this section, we will download a pretrained small version of BERT, then fine-tune it for natural language inference on the SNLI dataset.
英語のヒント
この節では、事前学習したBERTの小さな版をダウンロードし、それをSNLIのデータセットでの自然言語推論のために微調整する。
import json
import multiprocessing
import os
import torch
from torch import nn
from d2l import torch as d2l