Tutorial on custom dataloaders (NOT datasets)
@krishnakalyan3 is already working on this.
Since Nov 5, 2023.
- Dominant language
- Python
- Stars
- 9.3k
- Forks
- 4.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 4
Description
I really like this tutorial on custom datasets. However, the torch.utils.data.DataLoader class is only briefly mentioned in it:
However, we are losing a lot of features by using a simple for loop to iterate over the data. In particular, we are missing out on:
- Batching the data
- Shuffling the data
- Load the data in parallel using multiprocessing workers.
torch.utils.data.DataLoaderis an iterator which provides all these features. Parameters used below should be clear. One parameter of interest is collate_fn . You can specify how exactly the samples need to be batched using collate_fn . However, default collate should work fine for most use cases.
I am aware of this issue and this issue but neither have led to a tutorial.
I am happy to make a tutorial on custom dataloaders using the torch.utils.data.DataLoader class, focusing on how to interface with its parameters, especially the num_workers and collate_fn parameters. Also, I am not sure if it is possible to inherit from the torch.utils.data.DataLoader class, similar to the torch.utils.data.Dataset, so I would appreciate some guidance on this.
This would be my first ever tutorial, so some guidance on formatting would be greatly helpful.
cc @suraj813 @sekyondaMeta @svekars @carljparker @NicolasHug @kit1980 @subramen
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.