Lightning Talk: Fast, Scalable Distributed Training with StreamingDataset - Saaketh Narayan

PyTorch · Advanced ·🎨 Image & Video AI ·1y ago

Key Takeaways

The video discusses StreamingDataset, a PyTorch iterable dataset designed for fast and scalable distributed training, and its applications in training large models with thousands of GPUs.

Full Transcript

so I'm s the Ryan uh today I'm just going to talk a little bit how um our open source streaming data set enables uh fast scalable distributed training so yeah so I guess this is just what we're going to talk about um go through these four and then hopefully we'll have some time for Q&A at the end um cool so streaming data set is a pytorch iterable data set um it is built purpose built for fast distributed training um and it makes uh basically stream streaming your data from cloud storage as fast and cheap and easy as possible um so some examples of how we've been able to train with streaming as well as our customers are um we've been able to scale with streaming to thousands of gpus um dbrx for example was trained on uh more than 3,000 gpus and is a 132 billion parameter model um we've also internally used huge data sets like hundreds of terabytes and streaming has performed well on all of these um across many data modalities and many model types um so why is streaming needed so without streaming there's a bunch of challenges that you see especially related to your data and and model training honestly um is oftentimes blocked by data challenges so without streaming you have you know your data can't be ingested by your models your training is slowed down because of data loader bottlenecks um you can't combine multiple data sources training resumption becomes very hard Etc and and with streaming as you can see I'm not just going to go I'm not going to go through all these but um we've been able to successfully address address a lot of these challenges so um one thing we really focus on is getting the most throughput out of your training uh out of your data loading so on the left here you see some an example of having really bad throughput so at sporadic intervals during your training process you'll be dead loader bottlenecked and you'll see like frequent throughput drops just like on the left um if you really have good throughput you should see something like on the right um the second thing here is data mixing and shuffling so in this example we have a bunch of data sources so C4 GitHub and like an internal data set um streaming lets you just create stream objects over these data sources specify some sort of proportion and seamlessly mix these data sets um during your training um another feature that is really important to us is elastically deterministic training so with streaming data set as you see on the top you get fully deterministic loss curves whether you use 1 8 16 32 or 64 gpus um this is really important because it lets you automatically scale whatever runs you did at small scale to very large GPU scales even in the middle of training you can just take your run on 32 gpus say and scale it up to 128 um and you will get deterministic resumption every single time so here's another example of where deterministic resumption comes into play if I have data that's stored among many Cloud providers then I can just continue this training run uh let's say you know I have a oci failure or something I want to trade from S3 then I can just resume my training run straight from s three with the same data set um so how does this all work uh the first step is you need to convert your data into a streaming data set inestable format and the second thing is there's uh some mechanisms that happen during training that sort of enable all these features that I just talked about so the first step is data set conversion so you take your raw data set samples shown here in Gray um let's say they're like a CSV file whatever you want and you pass these through MDS writer objects so what these do is these serialize your raw data set samples into binary um using these uh MDS writer objects and write out um row oriented Mosaic data shards so that's shown here in blue basically each Shard has your serialized sample as well as a header that describes where to seek to to access that particular sample so for example I'll I'll write out maybe an image and it'll say Okay image 3 is at you know um byte let's say 500 and and we can very easily very quickly just uh access the sample in the header and then seek to where that sample lives in The Shard and that allows for really fast low latency random sample access during training what happens is we store basically you can store all of your data sets or data sources in in the cloud and so here we have two data sources or streams um each one of them has a bunch of shards as well as an Associated index. Json file so this index. Json file describes all of your sample uh data set metadata so for example how many shards are in there how many samples are in each Shard uh how many bytes do I expect from each sample stuff like that um and dur when the streaming data set is initialized these index. Json files are downloaded so we have an idea of what exactly your data is composed of then we deterministically partition your samples among nodes gpus and data loaded workers so here's a sort of minimized view of this um my total sample space is composed of samples across these two data sources so that's shown here in blue and in green I have I'm training on two nodes each with eight gpus so I want to split up all of these samples across workers nodes and gpus such that when I increase my number of nodes this partitioning stays the same so what this allows me to do is basically I need to maintain the invariant that each Global batch regardless of the number of nodes or gpus or workers I'm using is composed of the same number of samples um not just the same number of samples but the same sample IDs um so we make sure that this determinist uh this partitioning is deterministic and then we can also apply some partial shuffling algorithms that are going to take the samples that are assigned to each node and uh distribute them among among the nodes such that your data set egress costs are still minimized so you still have the same sample IDs and shards assigned to each node but you have really good uh Shuffle quality so this enables a lot of different uh things that you can see in our documentation such as different patching methods various different shuffles and we've done a lot of work to make sure that these partial shuffles are equivalent in quality and model conversions to like fully shuffling your data which um if you're trying to download shards is is highly inefficient so during training what happens is uh your data lives in in cloud storage so each datal loader worker is assigned some portion of the sample partition tensor and dat loader workers check if The Shard that contains the sample that they need is present on disk and if it's not they go ahead and download it and this happens sort of uh preemptively this happens ahead of time and we're able to prefetch shards um these shards are downloaded from the cloud and then because of the row oriented very low latency uh MDS format we're able to just um very quickly retrieve these samples each data loader worker retrieves these samples from the shards that are on disk and loads them into GPU for training so yeah that's sort of an overview of of streaming um and yeah would love to feel any questions from you guys thank you

Original Description

Lightning Talk: Fast, Scalable Distributed Training with StreamingDataset - Saaketh Narayan, Databricks StreamingDataset makes training on large datasets from cloud storage as fast, cheap, and scalable as possible. It’s specially designed for multi-node, distributed training for large models — maximizing correctness guarantees, performance, and ease of use. Key features include elastically deterministic training, instant mid-epoch resumption, effective shuffling, high training throughput, and flexible data mixing, among other features. When training with StreamingDataset, the data shards are written to cloud storage in MDS, our file format that allows for low-latency random access to samples. By being as efficient as possible with shard downloads and shuffling, StreamingDataset minimizes egress costs while ensuring that dataloading never bottlenecks model training. StreamingDataset powers training for LLMs with over 100 billion parameters like DBRX, to advanced diffusion models, to two-tower recommendation models, and more, scaling to training jobs on thousands of GPUs with ease. Join us to learn how StreamingDataset can elevate your distributed model training experience.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from PyTorch · PyTorch · 0 of 60

← Previous Next →
1 What is PyTorch?
What is PyTorch?
PyTorch
2 PyTorch Tutorial: A Quick Preview
PyTorch Tutorial: A Quick Preview
PyTorch
3 PyTorch Summer Hackathon 2019
PyTorch Summer Hackathon 2019
PyTorch
4 Tips and Tricks on Hacking with PyTorch: A Quick Tutorial by Brad Heintz
Tips and Tricks on Hacking with PyTorch: A Quick Tutorial by Brad Heintz
PyTorch
5 PyTorch 1.2 and PyTorch Hub: A Quick Introduction by Soumith Chintala and Ailing Zhang
PyTorch 1.2 and PyTorch Hub: A Quick Introduction by Soumith Chintala and Ailing Zhang
PyTorch
6 Torchtext 0.4 with Supervised Learning Datasets: A Quick Introduction by George Zhang
Torchtext 0.4 with Supervised Learning Datasets: A Quick Introduction by George Zhang
PyTorch
7 Torchaudio 0.3 with Kaldi Compatibility, New Transforms: A Quick Introduction by Jason Lian
Torchaudio 0.3 with Kaldi Compatibility, New Transforms: A Quick Introduction by Jason Lian
PyTorch
8 Torchvision 0.4 with Support for Video: A Quick Introduction by Francisco Massa
Torchvision 0.4 with Support for Video: A Quick Introduction by Francisco Massa
PyTorch
9 Introduction to Machine Learning for Developers at F8 2019
Introduction to Machine Learning for Developers at F8 2019
PyTorch
10 Powered by PyTorch at F8 2019
Powered by PyTorch at F8 2019
PyTorch
11 Developing and Scaling AI Experiences at Facebook with PyTorch at F8 2019
Developing and Scaling AI Experiences at Facebook with PyTorch at F8 2019
PyTorch
12 New Approaches to Image and Video Reconstruction Using Deep Learning at Facebook at F8 2019
New Approaches to Image and Video Reconstruction Using Deep Learning at Facebook at F8 2019
PyTorch
13 PyTorch Developer Conference 2018: Recap
PyTorch Developer Conference 2018: Recap
PyTorch
14 PyTorch Developer Conference 2018: Keynote & Deep Dive
PyTorch Developer Conference 2018: Keynote & Deep Dive
PyTorch
15 PyTorch Developer Conference 2018: Production & Research Sessions
PyTorch Developer Conference 2018: Production & Research Sessions
PyTorch
16 PyTorch Developer Conference 2018: Cloud & Academia Sessions
PyTorch Developer Conference 2018: Cloud & Academia Sessions
PyTorch
17 PyTorch Developer Conference 2018: Enterprise, Education, & Future of AI Panel
PyTorch Developer Conference 2018: Enterprise, Education, & Future of AI Panel
PyTorch
18 PyTorch Developer Conference 2019 | Full Livestream
PyTorch Developer Conference 2019 | Full Livestream
PyTorch
19 PyTorch Developer Conference 2019: Recap
PyTorch Developer Conference 2019: Recap
PyTorch
20 PyTorch Developer Conference Keynote - Mike Schroepfer
PyTorch Developer Conference Keynote - Mike Schroepfer
PyTorch
21 What’s new in PyTorch 1.3 - Lin Qiao
What’s new in PyTorch 1.3 - Lin Qiao
PyTorch
22 PyTorch Front-End Features: Named Tensors and Type Promotion - Gregory Chanan
PyTorch Front-End Features: Named Tensors and Type Promotion - Gregory Chanan
PyTorch
23 Research to Production: PyTorch JIT/TorchScript Updates - Michael Suo
Research to Production: PyTorch JIT/TorchScript Updates - Michael Suo
PyTorch
24 Quantization - Dmytro Dzhulgakov
Quantization - Dmytro Dzhulgakov
PyTorch
25 PyTorch ONNX Export Support - Lara Haidar, Microsoft
PyTorch ONNX Export Support - Lara Haidar, Microsoft
PyTorch
26 Apex -  Michael Carilli, NVIDIA
Apex - Michael Carilli, NVIDIA
PyTorch
27 Dataloader Design for PyTorch - Tongzhou Wang, MIT
Dataloader Design for PyTorch - Tongzhou Wang, MIT
PyTorch
28 Linear Algebra in PyTorch - Vishwak Srinivasan, CMU
Linear Algebra in PyTorch - Vishwak Srinivasan, CMU
PyTorch
29 PyTorch Mobile - David Reiss
PyTorch Mobile - David Reiss
PyTorch
30 Model Interpretability with Captum - Narine Kokhilkyan
Model Interpretability with Captum - Narine Kokhilkyan
PyTorch
31 Detectron2 - Next Gen Object Detection Library - Yuxin Wu
Detectron2 - Next Gen Object Detection Library - Yuxin Wu
PyTorch
32 Speech Extensions to Fairseq - Dmytro Okhonko
Speech Extensions to Fairseq - Dmytro Okhonko
PyTorch
33 PyTorch on Google Cloud TPUs - Google, Salesforce, Facebook
PyTorch on Google Cloud TPUs - Google, Salesforce, Facebook
PyTorch
34 PyTorch Summer Hackathon Winners - Joe Spisak, Sebastien Arnold, Tristan Deleu
PyTorch Summer Hackathon Winners - Joe Spisak, Sebastien Arnold, Tristan Deleu
PyTorch
35 PyTorch in Robotics - Yisong Yue, Caltech
PyTorch in Robotics - Yisong Yue, Caltech
PyTorch
36 StanfordNLP - Yuhao Zhang, Stanford
StanfordNLP - Yuhao Zhang, Stanford
PyTorch
37 Sotabench for Reproducible Research - Robert Stojnic, Papers with Code
Sotabench for Reproducible Research - Robert Stojnic, Papers with Code
PyTorch
38 Collaborative Natural Language Inference - Sasha Rush, Cornell
Collaborative Natural Language Inference - Sasha Rush, Cornell
PyTorch
39 Privacy Preserving AI - Andrew Trask, OpenMined
Privacy Preserving AI - Andrew Trask, OpenMined
PyTorch
40 CrypTen - Laurens van der Maaten
CrypTen - Laurens van der Maaten
PyTorch
41 PyTorch at Uber - Sidney Zhang, Uber
PyTorch at Uber - Sidney Zhang, Uber
PyTorch
42 PyTorch at Tesla - Andrej Karpathy, Tesla
PyTorch at Tesla - Andrej Karpathy, Tesla
PyTorch
43 PyTorch at Microsoft - Saurabh Tiwary, Microsoft
PyTorch at Microsoft - Saurabh Tiwary, Microsoft
PyTorch
44 PyTorch at Dolby Labs - Vivek Kumar, Dolby Labs
PyTorch at Dolby Labs - Vivek Kumar, Dolby Labs
PyTorch
45 PyTorch Developer Conference 2019 - Panel Discussion
PyTorch Developer Conference 2019 - Panel Discussion
PyTorch
46 Using deep learning and PyTorch to power next gen aircraft at Caltech
Using deep learning and PyTorch to power next gen aircraft at Caltech
PyTorch
47 Named Tensors, Model Quantization, and the Latest PyTorch Features - Part 1
Named Tensors, Model Quantization, and the Latest PyTorch Features - Part 1
PyTorch
48 TorchScript and PyTorch JIT | Deep Dive
TorchScript and PyTorch JIT | Deep Dive
PyTorch
49 Announcing the PyTorch Global Summer Hackathon 2020
Announcing the PyTorch Global Summer Hackathon 2020
PyTorch
50 Opening Up the Black Box: Model Understanding with Captum and PyTorch
Opening Up the Black Box: Model Understanding with Captum and PyTorch
PyTorch
51 PyTorch Mobile Runtime for Android
PyTorch Mobile Runtime for Android
PyTorch
52 Torchvision in 5 minutes
Torchvision in 5 minutes
PyTorch
53 3D Deep Learning with PyTorch3D
3D Deep Learning with PyTorch3D
PyTorch
54 What is Torchtext?
What is Torchtext?
PyTorch
55 TorchAudio: A Quick Intro
TorchAudio: A Quick Intro
PyTorch
56 PyTorch Mobile Runtime for iOS
PyTorch Mobile Runtime for iOS
PyTorch
57 PySlowFast: Deep learning with Video
PySlowFast: Deep learning with Video
PyTorch
58 PyTorch Pruning | How it's Made by Michela Paganini
PyTorch Pruning | How it's Made by Michela Paganini
PyTorch
59 Measuring Fairness in Machine Learning Systems
Measuring Fairness in Machine Learning Systems
PyTorch
60 PyTorch for Hackathons
PyTorch for Hackathons
PyTorch

The video discusses StreamingDataset, a PyTorch iterable dataset designed for fast and scalable distributed training, and its applications in training large models with thousands of GPUs. It covers topics such as data loading, throughput, data mixing, and shuffling, and provides an overview of how StreamingDataset works.

Key Takeaways
  1. Convert data into StreamingDataset format
  2. Initialize StreamingDataset and download index files
  3. Partition samples among nodes, GPUs, and data loader workers
  4. Apply partial shuffling algorithms
  5. Download shards and retrieve samples for training
💡 StreamingDataset enables fast and scalable distributed training by providing a row-oriented, low-latency format for storing and retrieving data samples, allowing for efficient data loading and processing.

Related Reads

📰
50+ Sequential Images, One Prompt in Codex
Learn to generate sequential images with Codex using a single prompt and understand the limitations of this approach
Medium · ChatGPT
📰
How can I batch-generate 3D assets from prompts or images using an API, and which 3D generation APIs support batch generation?
Learn to batch-generate 3D assets from prompts or images using APIs for efficient pipeline creation
Reddit r/artificial
📰
How AI Head Swap Works: The Technology Behind Realistic AI Image Replacement
Learn how AI head swap technology works and its applications in image editing
Dev.to AI
📰
How I Built an AI Pet Portrait Generator That Turns Photos Into Art
Learn how to build an AI pet portrait generator that turns photos into art using deep learning techniques and Python libraries
Dev.to · William Li
Up next
Topview AI Features EXPLAINED: Pros & Cons HONEST Review
MaxonShire
Watch →