I think it’s very similar to the text classification datasets in torchtext. You should be able to use most of the building blocks there. The only part to change is the _csv_iterator function here 4. In the original datasets, labels come before the text. But in your case, the text comes before the labels.
We suggest to use the new abstraction (text classification datasets follow the new abstraction) because it’s more compatible with torch.data.utils. Feel free to open issues on Github if you have any questions.