We boosted load_dataset('dataset', streaming=True), streaming datasets without downloading them with one line of code!
Start training on multi-TB datasets immediately, without complex setups, downloading, no "disk out of space", or 429 βstop requesting!β errors.It's super fast! Outrunning our local SSDs when training on 64xH100 with 256 workers downloading data. We've improved streaming to have 100x fewer requests, β 10Γ faster data resolution β 2x sample/sec, β 0 worker crashes at 256 concurrent workers. (Related: Silicon Motion demos SM8466 PCIe 6.0 SSD controller, ex...)
Loading data, especially at the terabyte scale, is a major pain in any machine learning workflow. We suffered this while training SmolLM3, at one point we had to wait 3 hours before each run to download enough data. (Related: Tech Report: βDeterminedβ woman completes 7 marathons i...)
According to recent reports, streaming has always been possible in the datasets library, but large scale training with massive datasets remained a challenge. That changes today π₯. We spent a few months improving the backend, focusing on streaming datasets to make it faster and more efficient.
Industry observers note that first things first: our changes are backwards compatible. You can still stream any dataset from the Hub with the same simple streaming=True flag. It's as easy as ever. π.
Thousands of AI developers around the world use datasets daily; they should just get improved performance with zero extra work.
In a recent development, streaming was a lifesaver to promptly understand a dataset, but to train models, people were usually downloading the data locally, or using a cloud storage service such as S3. That's what we were doing for training SmolVLM, we had all of our data on S3 and were streaming directly from it.
Recent findings suggest that we wanted to change that, so we decided to use streaming from the Hub when we were developing nanoVLM. Soon we found a significant glitch: our test run generated over 100,000 requests in under a minute, which got our IP blocked by the Hub! π This happened because every DataLoader worker was initializing the dataset independently. As we dug deeper, we found that this creates a storm of redundant requests, many of which are unnecessary. Our changes ultimately reduced startup requests by a factor of 100. In total, our improvements delivered:.
Recent findings suggest that so, what changed? We focused on two phases: startup and streaming.
1. Startupβ‘οΈ The initial resolution of data files was creating a ton of requests. We made two major changes:.
Recent findings suggest that 2. Streaming ποΈ To improve throughput during streaming itself, we've introduced two latest features:.
This is how we can increase the minimum request size when streaming from 32MiB (default) to 128MiB and configure prefetching:.
Together, these improvements can double your data throughput, allowing you to train faster and more efficiently.
Hugging Face uses Xet: a dedupe-based storage which enables fast deduped uploads and downloads. Unlike traditional remote storage, data transfers are faster on Xet because duplicated data is only transferred once. For example: uploading a large scale dataset to Hugging Face leverages Xet which accelerates uploads. Once the dataset is uploaded, it can be streamed right away.
Deduplication for Parquet is enabled through Parquet Content Defined Chunking (CDC). Thanks to Parquet CDC and Xet deduplication, uploading datasets on Hugging Face is faster than on any traditional remote storage.
This is supported by our pyspark_huggingface package, a Spark Data Source to read/write HF datasets. It includes Parquet CDC and Xet support, accelerating data transfers on HF dramatically.
Recent findings suggest that some data file formats are not supported in datasets, and sometimes there is a need for more control, so we made it easy to build custom streaming pipelines. This has been battle-tested in the LeRobot library to sample video frames, and in the WebDataset library to stream TAR archives.
We improved the HfFileSystem in the huggingface_hub library to efficiently read files from remote Hugging Face dataset repositories and stream data:.
Passing a HfFileSystem to a torch DataLoader reuses the cached results from .ls() and .glob() which eliminates the need for additional requests when listing data files.
Industry observers note that we're now using these streaming enhancements in nanoVLM to train the next generation of SmolVLMs. With these tweaks, we achieve better performance from streaming than from training on our cluster's hierarchical hard disk setup. In fact, streaming is now as fast as reading the data from local SSDs! Previously, transferring data to local SSDs was the process that used to delay our trainings by three-hours. For more details, check out our GitHub.
In a recent development, these powerful newly introduced features landed in the datasets and huggingface_hub libraries. To take advantage of them, simply upgrade your libraries and check out the documentation:.
Sources indicate that to celebrate this, we preconcatenated and shuffled all the data sources in FineVision into FineVisionMax. You can use this single combined dataset to train your VLM β no need to handle multiple datasets manually!
And you can see how we do it at scale in nanoVLM!
steaming is always the way to go since generally neural nets trainings are stateful any wayπ.
Hey guys, just a quick question:.
Recent findings suggest that is streaming the right way for this scenario: I have limited storage (say < 100GB). The training dataset has around 1T token (and used 6TB of real storage).
It has been revealed that will the already "streamed" dataset be stored on disk or will it be deleted after the training steps have completed on one chunk/parquet? I want to avoid the scenario that my local disk is filled up during training, because I only have limited local space.
yes, just stream it, it's a no brainer in your case which won't fill your disk at all just make sure your networking infra is fast enough.
To understand clearly, you upload the Perquet DS (I do need to store it somewhere, and Perquet is optimized on Hub) here on the Hub and use the streaming feature while having a constant net connection, right?
In a recent development, yes! Probably the easiest way to get Parquet already optimised for streaming is to use the datasets.Dataset push_to_hub method (https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.DatasetDict.push_to_hub).
