Using pretrained word embeddings

Pretrained word embeddings would be useful when we are working in specific domains, such as medicine and manufacturing, where we have lot of data to train the embeddings. When we have little data on which we cannot meaningfully train the embeddings, we can use embeddings, which are trained on different data corpuses such as Wikipedia, Google News and Twitter tweets. A lot of teams have open source word embeddings trained using different approaches. In this section, we will explore how torchtext makes it easier to use different word embeddings, and how to use them in our PyTorch models. It is similar to transfer learning, which we use in computer vision applications. Typically, using pretrained embedding would involve the following steps:

  • Downloading the embeddings
  • Loading the embeddings in the model
  • Freezing the embedding layer weights

Let's explore in detail how each step is implemented.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.72.15