recurrent neural networks #define list of tuples of fields trainval_fields [("text",text),("label",label)#contruct dataset train_dataval_data data tabulardataset splits(path input_data_pathtrain "train csv"validation "valid csv"format "csv"skip_header truefields trainval_fields#build vocab using pretrained max_vocab_size text build_vocab(train_datamax_size max_vocab_ sizevectors 'fasttext simple 'batch_size train_iteratorval_iterator data bucketiterator splits(train_dataval_data)batch_size batch_sizesort_key lambda :len( text)sort_within_batch truedevice devicewe will focus only on the changes in the preceding code snippet while defining our data fieldswe used the tokenizer from spacy using the string spacy for the tokenize parameter sufficespytorch manages the necessary heavy lifting in the backend we also added the include_length parameter as true this is necessaryas we would add padding and sort the samples within batch later to leverage thiswe now need to pass the length of the sample along with the text to the forward function in our rnn model' class definition