- Notifications
You must be signed in to change notification settings - Fork630
A GPU-accelerated library containing highly optimized building blocks and an execution engine for data processing to accelerate deep learning training and inference applications.
License
NVIDIA/DALI
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The NVIDIA Data Loading Library (DALI) is a GPU-accelerated library for data loadingand pre-processing to accelerate deep learning applications. It provides acollection of highly optimized building blocks for loading and processingimage, video and audio data. It can be used as a portable drop-in replacementfor built in data loaders and data iterators in popular deep learning frameworks.
Deep learning applications require complex, multi-stage data processing pipelinesthat include loading, decoding, cropping, resizing, and many other augmentations.These data processing pipelines, which are currently executed on the CPU, have become abottleneck, limiting the performance and scalability of training and inference.
DALI addresses the problem of the CPU bottleneck by offloading data preprocessing to theGPU. Additionally, DALI relies on its own execution engine, built to maximize the throughputof the input pipeline. Features such as prefetching, parallel execution, and batch processingare handled transparently for the user.
In addition, the deep learning frameworks have multiple data pre-processing implementations,resulting in challenges such as portability of training and inference workflows, and codemaintainability. Data processing pipelines implemented using DALI are portable because theycan easily be retargeted to TensorFlow, PyTorch, and PaddlePaddle.
DALI in action:
fromnvidia.dali.pipelineimportpipeline_defimportnvidia.dali.typesastypesimportnvidia.dali.fnasfnfromnvidia.dali.plugin.pytorchimportDALIGenericIteratorimportos# To run with different data, see documentation of nvidia.dali.fn.readers.file# points to https://github.com/NVIDIA/DALI_extradata_root_dir=os.environ['DALI_EXTRA_PATH']images_dir=os.path.join(data_root_dir,'db','single','jpeg')defloss_func(pred,y):passdefmodel(x):passdefbackward(loss,model):pass@pipeline_def(num_threads=4,device_id=0)defget_dali_pipeline():images,labels=fn.readers.file(file_root=images_dir,random_shuffle=True,name="Reader")# decode data on the GPUimages=fn.decoders.image_random_crop(images,device="mixed",output_type=types.RGB)# the rest of processing happens on the GPU as wellimages=fn.resize(images,resize_x=256,resize_y=256)images=fn.crop_mirror_normalize(images,crop_h=224,crop_w=224,mean=[0.485*255,0.456*255,0.406*255],std=[0.229*255,0.224*255,0.225*255],mirror=fn.random.coin_flip())returnimages,labelstrain_data=DALIGenericIterator( [get_dali_pipeline(batch_size=16)], ['data','label'],reader_name='Reader')fori,datainenumerate(train_data):x,y=data[0]['data'],data[0]['label']pred=model(x)loss=loss_func(pred,y)backward(loss,model)
- Easy-to-use functional style Python API.
- Multiple data formats support - LMDB, RecordIO, TFRecord, COCO, JPEG, JPEG 2000, WAV, FLAC, OGG, H.264, VP9 and HEVC.
- Portable across popular deep learning frameworks: TensorFlow, PyTorch, PaddlePaddle, JAX.
- Supports CPU and GPU execution.
- Scalable across multiple GPUs.
- Flexible graphs let developers create custom pipelines.
- Extensible for user-specific needs with custom operators.
- Accelerates image classification (ResNet-50), object detection (SSD) workloads as well as ASR models (Jasper, RNN-T).
- Allows direct data path between storage and GPU memory withGPUDirect Storage.
- Easy integration withNVIDIA Triton Inference ServerwithDALI TRITON Backend.
- Open source.
- During Kaggle computer vision competitions:"DALI is one of the best things I have learned in this competition"
- Lightning Pose - state of the art pose estimation research model
- To improve the resource utilization in Advanced Computing Infrastructure
- MLPerf - the industry standard for benchmarking compute and deep learning hardware and software
- "we optimized major models inside eBay with the DALI framework"
The following issue represents a high-level overview of our 2024 plan. You should be aware that thisroadmap may change at any time and the order of its items does not reflect any type of priority.
We strongly encourage you to comment on our roadmap and provide us feedback on the mentionedGitHub issue.
To install the latest DALI release for the latest CUDA version (12.x):
pip install nvidia-dali-cuda120# orpip install --extra-index-url https://pypi.nvidia.com --upgrade nvidia-dali-cuda120
DALI requiresNVIDIA driver supporting the appropriate CUDA version.In case of DALI based on CUDA 12, it requiresCUDA Toolkitto be installed.
DALI comes preinstalled in theTensorFlow,PyTorch,andPaddlePaddlecontainers onNVIDIA GPU Cloud.
For other installation paths (TensorFlow plugin, older CUDA version, nightly and weekly builds, etc),and specific requirements please refer to theInstallation Guide.
To build DALI from source, please refer to theCompilation Guide.
An introduction to DALI can be found in theGetting Started page.
More advanced examples can be found in theExamples and Tutorials page.
For an interactive version (Jupyter notebook) of the examples, go to thedocs/examplesdirectory.
Note: Select theLatest Release Documentationor theNightly Release Documentation, which stays in sync with the main branch,depending on your version.
- GPU Technology Conference 2024;Optimizing Inference Model Serving for Highest Performance at eBay; Yiheng Wang:event
- GPU Technology Conference 2023;Developer Breakout: Accelerating Enterprise Workflows With Triton Server and DALI; Brandon Tuttle:event.
- GPU Technology Conference 2023;GPU-Accelerating End-to-End Geospatial Workflows; Kevin Green:event.
- GPU Technology Conference 2022;Effective NVIDIA DALI: Accelerating Real-life Deep-learning Applications; Rafał Banaś:event.
- GPU Technology Conference 2022;Introduction to NVIDIA DALI: GPU-accelerated Data Preprocessing; Joaquin Anton Guirao:event.
- GPU Technology Conference 2021;NVIDIA DALI: GPU-Powered Data Preprocessing by Krzysztof Łęcki and Michał Szołucha:event.
- GPU Technology Conference 2020;Fast Data Pre-Processing with NVIDIA Data Loading Library (DALI); Albert Wolant, Joaquin Anton Guirao:recording.
- GPU Technology Conference 2019;Fast AI data pre-preprocessing with DALI; Janusz Lisiecki, Michał Zientkiewicz:slides,recording.
- GPU Technology Conference 2019;Integration of DALI with TensorRT on Xavier; Josh Park and Anurag Dixit:slides,recording.
- GPU Technology Conference 2018;Fast data pipeline for deep learning training, T. Gale, S. Layton and P. Trędak:slides,recording.
- Developer Page.
- Blog Posts.
We welcome contributions to DALI. To contribute to DALI and make pull requests,follow the guidelines outlined in theContributingdocument.
If you are looking for a task good for the start please check one fromexternal contribution welcome label.
We appreciate feedback, questions or bug reports. When you need helpwith the code, follow the process outlined in theStack Overflow document. Ensure that theposted examples are:
- minimal: Use as little code as possible that still produces the same problem.
- complete: Provide all parts needed to reproduce the problem.Check if you can strip external dependency and still show the problem.The less time we spend on reproducing the problems, the more time wecan dedicate to the fixes.
- verifiable: Test the code you are about to provide, to make surethat it reproduces the problem. Remove all other problems that are notrelated to your request.
DALI was originally built with major contributions from Trevor Gale, Przemek Tredak,Simon Layton, Andrei Ivanov and Serge Panev.
About
A GPU-accelerated library containing highly optimized building blocks and an execution engine for data processing to accelerate deep learning training and inference applications.