recurrent neural networks while building the vocabularywe use vectors 'fasttext simple dto tell pytorch to download the pretrained fasttext vector and create an embedding vector for the words in our text field (if you are using kaggle kernelthe internet option should be turned on in the notebook environment settingsthis pretrained vector has dimensions we need to note this change while creating the network instance this step might actually take whiledepending on your internet speeds finallywe also enabled sorting and defined the sort key pytorch downloads the defined pretrained vectors (usually mn or moreand creates subset for our use case based on the , tokens let' now define our improved sequence modelas demonstrated in listing - listing - defining the (improvedrnn class class improvedrnn(nn module)def __init__(selfvocab_sizeembedding_dimhidden_dimoutput_dimn_layersbidirectionaldropoutpad_idx)super(__init__(self embedding nn embedding(vocab_sizeembedding_dimpadding_idx pad_idxself lstm nn lstm(embedding_dimhidden_dimnum_layers=n_layersbidirectional=bidirectionaldropout=dropoutself fc nn linear(hidden_dim output_dimself dropout nn dropout(dropout