recurrent neural networks in our second experimentwe will leverage tokenizer from spacy (rather than using our custom tokenizerand pretrained word embedding (instead of training one from scratch)and add bidirectional lstm layers (instead of unidirectional rnn layerswe will also add dropout to reduce overfitting we actually need to start freshrather than continuing with the same code base (though the changes are minimalas usualwe begin by importing the required packagesas shown in listing - listing - importing the required packages import numpy as np linear algebra import pandas as pd data processingcsv file / ( pd read_csvimport torch,torchtext from torch import nnoptim from torch optim import adam from torchtext import data if torch cuda is_available()device "cudaelsedevice "cpuprint("device =",deviceinput_data_path /input/imdb-dataset-sentiment-analysis-incsv-format/#define fields for our input dataset text data field(sequential=truelowertrue,tokenize 'spacy'include_lengths truelabel data field(sequential false,use_vocab false