第15章自然言語処理:事前学習
15.3. The Dataset for Pretraining Word Embeddings15.3 単語埋め込みを事前学習するためのデータセット
Now that we know the technical details of the word2vec models and approximate training methods, let’s walk through their implementations. Specifically, we will take the skip-gram model in Section 15.1 and negative sampling in Section 15.2 as an example. In this section, we begin with the dataset for pretraining the word embedding model: the original format of the data will be transformed into minibatches that can be iterated over during training.
英語のヒント
import collections
import math
import os
import random
import torch
from d2l import torch as d2l