SNLI is provided as a JSONL file, which means the torchtext JSON loader can be used more or less unmodified; it looks like the TREC dataset doesn’t quite match an existing torchtext loader, so you’d have to write a small loader that subclasses torchtext.data.Dataset. I’d look at the TranslationDataset code 33, which is quite similar to what you’d need to do.