1. Learn
  2. /
  3. Courses
  4. /
  5. Deep Learning for Text with PyTorch

Connected

Exercise

Building a GRU model for text

At PyBooks, the team has been impressed with the performance of the two models you previously trained. However, in their pursuit of excellence, they want to ensure the selection of the absolute best model for the task at hand. Therefore, they have asked you to further expand the project by experimenting with the capabilities of GRU models, renowned for their efficiency and effectiveness in text classification tasks. Your new assignment is to apply the GRU model to classify articles from the Newsgroup dataset into the following categories:

rec.autos, sci.med, and comp.graphics.

The following packages have been loaded for you: torch, nn, optim.

Instructions

100 XP
  • Complete the GRU class with the required parameters.
  • Initialize the model with the same parameters.
  • Train the model: pass the parameters to the criterion function, and backpropagate the loss.