I’m not completely sure I understand the question correctly, so feel free to update the description a bit and correct me, if I’m misunderstanding it.
In case you want to access the complete dataset and are preloading it in the __init__ or are passing it directly to it, you should be able to access the internal attributes via e.g. dataset.data.
On the other hand, if you want to create batches of 5000 samples, you can pass this dataset to a DataLoader with a batch_size=5000, which should then return the desired shapes.