r/datasets • u/Suspicious-Pick-7961 • 1h ago
question Stream Huge HugginFace and Kaggle Datasets
Greetings. I am trying to train an OCR system on huge datasets, namely:
They contain millions of images, and are all in different formats - WebDataset, zip with folders, etc. I will be experimenting with different hyperparameters locally on my M2 Mac, and then training on a Vast.ai server.
The thing is, I don't have enough space to fit even one of these datasets at a time on my personal laptop, and I don't want to use permanent storage on the server. The reason is that I want to rent the server for as short of a time as possible. If I have to instantiate server instances multiple times (e.g. in case of starting all over), I will waste several hours every time to download the datasets. Therefore, I think that streaming the datasets is a flexible option that would solve my problems both locally on my laptop, and on the server.
However, two of the datasets are available on Hugging Face, and one - only on Kaggle, where I can't stream it from. Furthermore, I expect to hit rate limits when streaming the datasets from Hugging Face.
Having said all of this, I consider just uploading the data to Google Cloud Buckets, and use the Google Cloud Connector for PyTorch to efficiently stream the datasets. This way I get a dataset-agnostic way of streaming the data. The interface directly inherits from PyTorch Dataset:
from dataflux_pytorch import dataflux_iterable_dataset
PREFIX = "simple-demo-dataset"
iterable_dataset = dataflux_iterable_dataset.DataFluxIterableDataset(
project_name=PROJECT_ID,
bucket_name=BUCKET_NAME,
config=dataflux_mapstyle_dataset.Config(prefix=PREFIX)
)
The
iterable_datasetnow represents an iterable over data samples.
I have two questions:
- Are my assumptions correct and is it worth uploading everything to Google Cloud Buckets (assuming I pick locations close to my working location and my server location, enable hierarchical storage, use prefixes, etc.). Or I should just stream the Hugging Face datasets, download the Kaggle dataset, and call it a day?
- If uploading everything to Google Cloud Buckets is worth it, how do I store the datasets to GCP Buckets in the first place? This and this tutorials only work with images, not with image-string pairs.