示例代码依赖 DALI_EXTRA_PATH 环境变量指向额外数据集仓库,需另行下载;CUDA 12 版本除驱动外还需安装 CUDA Toolkit;Triton 集成需单独安装 DALI TRITON Backend。
DALI
NVIDIAApache-2.0活跃维护GPU 加速的数据预处理库,提供高度优化的图像、音频处理算子和执行引擎,解决深度学习训练中数据管道拖慢 GPU 的瓶颈。
A GPU-accelerated library containing highly optimized building blocks and an execution engine for data processing to accelerate deep learning training and inference applications.
pip install nvidia-dali-cuda120需要支持对应 CUDA 版本的 NVIDIA 驱动;CUDA 12 版 DALI 还要求安装 CUDA Toolkit。README 未给出具体显存要求。支持 CPU 与 GPU 执行,并可跨多 GPU 扩展。
NVIDIA 的 GPU 加速数据加载与预处理库,把 CPU 上的数据流水线卸载到 GPU,消除训练和推理的输入瓶颈
GPU 加速的数据预处理库,提供高度优化的图像、音频处理算子和执行引擎,解决深度学习训练中数据管道拖慢 GPU 的瓶颈。
核心能力
- 用 GPU 执行解码、裁剪、缩放等预处理,缓解 CPU 瓶颈
- 自带执行引擎,透明处理预取、并行执行和批处理
- 支持 LMDB、RecordIO、TFRecord、JPEG、WAV、H.264 等格式
- 流水线可移植到 TensorFlow、PyTorch、PaddlePaddle、JAX
- 提供 Pipeline 与 Dynamic 两种 Python API 写法
容易踩的坑
- v2.4.0DALI v2.4.0最新正式版2026-10-26 · 2026-10-26 08:13 UTC
Key Features and Enhancements
This DALI release includes the following key features and enhancements:
- Added experimental reader support for Google Cloud Storage (gs:// paths) (#6495, #6467)
- Improved arithmetic operators in dynamic mode (#6475, #6476, #6480, #6481)
- Added support for CUDA 13.4U1 (#6489, #6478)
- Added S3 support for webdataset index files (#6483)
- Add experimental support for Python 3.15 (#6461)
- Added documentation for Torchvision custom operators (#6490, #6470)
- Moved from custom DALI conda recipe to upstream nvidia-dali-feedstock (#6402, #6474)
Fixed Issues
- Fixed zero-extent GPU image launches (#6505)
- Thank you @arcusbuilds for your contribution!
- Fixed silent integer overflows in arithmetic operators (#6481, #6480)
- Fixed numpy reader returning unread sample data (#6482)
- Fixed torchvision ColorJitter’s missing hue to degrees conversion (#6471)
- Thank you @Kayvan-Zahiri for your contribution
- Fixed legacy viedo NVDEC reader using stale surface requirements (#6460)
Improvements
- Update VERSION to 2.4.0
- Bump packaging upper bound to 26.3 (#6523)
- Update DALI_DEPS_VERSION (#6521)
- TorchVision documentation (#6490)
- Extend static analysis for arithmetic operators (#6476)
- Add schema aliases. Use aliases in rename-only deprecations. (#6310)
- Retry install_pip_pkg with --ignore-installed after an unrecordable uninstall (#6485)
- Process workspace inputs and outputs without code duplication. (#6499)
- Update DALI_deps for gRPC cross-compilation (#6495)
- Document that random_shuffle shuffles only locally (#6491)
- Add Google Cloud Storage (gs://) reader support (#6467)
- Add S3 storage integration tests, and S3 support for webdataset index files (#6483)
- Move to CUDA 13.4 U1 (#6489)
- Deps update 09.2026 (#6477)
- Add DALI_INT64_VEC and use it in Constant (#6486)
- Update CUDA 13 Paddle package to 3.4.0 (#6488)
- Improve the sharding and shuffling documentation (#6484)
- Add CUDA 13.4 build configuration (#6478)
- Multiple crops example (#5656)
- Fix Coverity use-after-free in C API checkpointing test (#6473)
- Pull latest DALI deps hardinging (#6472)
- Update TorchVision API links in the documentation (#6470)
- Enable data analytics directly from nvidia-theme (#6469)
- Move from custom DALI conda recipe to upstream nvidia-dali-feedstock (#6402)
- Add CUDA 13 Paddle packages for Python versions (#6468)
- Skip Paddle iterator tests with ASan (#6465)
- Respect user warning filters in Python deprecation warnings (#6463)
- Fix flaky conditional merge test (#6457)
- Update DALI_DEPS_VERSION (patch libsound) (#6462)
- Add experimental support for Python 3.15 (#6461)
- Suggest a remedy when as_array hits a non-uniform tensor list (#6464)
- docs: fix minor typos in documentation (#6459)
- Add Secret scanning workflow (#6390)
- Enable copy-pr-bot for NVIDIA-hosted GitHub Actions runners (#6450)
- Warn when S3 SSL verification or plugin preload is configured (#6442)
- Disable XLA command buffers in JAX examples (#6449)
- Improve documentation for framework iterators and readers (#6435)
- Fix a dynamic mode thread-safety test (#6452)
Bug Fixes
- Fix schema alias test on platforms which don't have BUILD_CUFILE (#6524)
- Promote scalars to constants in ndd arithmetic operators (#6475)
- Fix zero-extent GPU image launches (#6505)
- Prevent silent integer overflows in arithmetic operators (#6481)
- Fix protobuf 36 serialization in ASAN builds (#6492)
- Fix int downcasting in dynamic mode (#6480)
- Keep NumPy 1 for Paddle 2.6 (#6487)
- Fix numpy reader returning unread sample data (#6482)
- Convert torchvision ColorJitter hue to degrees for fn.color_twist (#6471)
- Fix conda custom operator build and self-tests (#6474)
- Update Paddle examples for Paddle 3.4 (#6446)
- Prevent stale code ids in the transparent functions registry (#6458)
- Reconfigure NVDEC decoder for increased surface requirements (#6
- v2.3.0DALI v2.3.02026-08-28 · 2026-08-28 20:33 UTC
查看更新说明
Key Features and Enhancements
This DALI release includes the following key features and enhancements:
- Improved capture mode (transparent pipelining): (#6445, #6441, #6434, #6440, #6420, #6388)
- Support tracing random ops and external source (#6423, #6401)
- Added ndd.compile.invariant (#6429)
- Improved dynamic mode skill (#6447, #6389, #6421, #6448)
- Added support for nvImageCodec 0.9.0 (#6426)
- Added support for CUDA 13.3U1 (#6416)
- Improved StdCUFileStream (avoid unnecessary creation of buffered file-descriptors) (#6386)
- Thank you @lyquid617 for your contribution!
Fixed Issues
- Fixed insufficient validation of NPY shape sizes (#6443)
- Fixed wds2idx parsing with spaced tar owners and non-ASCII names (#6422, #6409)
- Fixed insufficient validation of RecordIO record length (#6406)
- Fixed parallel external source forwarding recycled output buffers (#6413)
- Added a check to reject non-string COCO file names (#6415)
- Fixed 0d reader tensor args handling in dynamic readers (#6398)
- Fixed insufficient validation of TFRecord payload length (#6405)
- Fixed malformed numpy headers parsing (#6410)
- Fixed external source prefetch drain with separated async executor (#6397)
- Added support for full-range VP9 video decoding (#6367)
Improvements
- Update VERSION to 2.3.0
- Improve call site detection in capture mode and add it to hw decoder bench (#6445)
- Add OpenAI metadata in the dynamic mode skill (#6447)
- Update NVSkill CI to latest template (#6448)
- Rename dynamic compile mode APIs to capture mode (#6441)
- Add capture mode documentation (#6440)
- Update DALI_DEPS_VERSION (#6439)
- Install missing python-build module in Jetson build image (#6438)
- Drop Python 3.13t-specific test dependencies and warn on 3.13t (#6436)
- Use python-build for package artifacts (#6433)
- Preserve JAX decorator metadata (#6427)
- Support random ops in transparent pipelining (#6423)
- Optimize passing non-tensor named arguments in Dynamic Mode (#6434)
- Fix coverity detected defects
- Add ndd.compile.invariant (#6429)
- Reduce the number of threads in test_parallel_pipelines (#6431)
- Upgrade nvimgcodec to 0.9.0 (#6426)
- Update third-party dependencies (#6418)
- Fix compiled external source tests on Python 3.10 (#6424)
- Pin versions in the dynamic mode skill requirements.txt (#6421)
- Test wds2idx names with spaces (#6414)
- Update CUDA to 13.3U1 and related libraries for CTK 12 & 13 (#6416)
- Add ExternalSource support to transparent pipelining (#6401)
- Optimize call site resolution. (#6420)
- Add license header to skill asset (#6412)
- Fix free-threaded Python 3.13 QA dependency constraints (#6417)
- Update FFmpeg build instructions (#6408)
- Fix URI fragment parsing without query (#6393)
- Fix TL1_tensorflow-dali_test and free threded 3.13 tests (#6403)
- Add ExternalSource to dynamic mode (#6395)
- Rename TL0_self_test_Ampere to TL0_self_test_arch_next (#6404)
- Update DALI_DEPS_VERSION (#6399)
- conda: pin libopencv to >=4.13,<5 (#6400)
- Accept function parameters and closure cells as arguments with compile=True (#6388)
- Add missing version selector for 2.1.1 (#6396)
- Refine dynamic mode skill eval (#6389)
- Switch back to upstream CV-CUDA. (#6392)
- Prevent deadlocks in test_parallel_pipelines when a worker fails (#6394)
- Add conda build option and CUDA target includes (#6316)
- feat: lazy open file handle (#6386)
Bug Fixes
- Fix incorrect link to 2.1.1 release (#6453)
- Validate NPY shape sizes before allocation (#6443)
- Bump up nvComp version to 5.3.0.16 (#6430)
- Fix wds2idx parsing with spaced tar owners (#6422)
- Fix num_workers swapped with batch_size in test parameters. (#6425)
- Validate RecordIO record lengths before parsing (#6406)
- Stop bundling FFmpeg libraries in Conda package (#6419)
- Fix parallel external source forwarding recycled output buffers (#6413)
- Improved capture mode (transparent pipelining): (#6445, #6441, #6434, #6440, #6420, #6388)
- v2.2.0DALI v2.2.02026-06-29 · 2026-06-29 12:39 UTC
查看更新说明
Key Features and Enhancements
This DALI release includes the following key features and enhancements:
- Improved DALI dynamic:
- Added transparent pipelining (#6382, #6357, #6363, #6323, #6301, #6298)
- Added support for checkpointing (#6368, #6340)
- Added static metadata inference (#6317, #6280, #6311)
- Added support for numpy dtypes (#6350)
- Improved dynamic mode control features (#6312)
- Improved random number generators (#6334, #6332)
- Improved performance (#6329)
- Improved Torchvision API (#6383, #6383, #6313, #6364, #6297, #6372)
- Added operators RandomResizedCrop, Crop, RandomApply, RandomGrayscale (#6369, #6353, #6342, #6335)
- Improved agent skills (#6376, #6358, #6375, #6368, #6374, #6271)
- Made nvImageCodec 0.8 a default image decoding backend. (#6366, #6349, #6344, #6343, #6337, #6293)
- Added support for CUDA 13.3 (#6371)
- Added support for nvCOMP to 5.2.0 (#6292)
- Improved DLPack support (#6261, #6307)
- Extended arithmetic operators coverage: bit shifts, bit not and modulo (#6294)
- Added support for shuffle_after_epoch parameter in WebDataset, TFRecord, and MXNet readers (#6288)
Fixed Issues
- Removed unnecessary samples' meta-data copies in FileReader (#6379)
- Thanks @fallintoplace for your contribution!
- Fixed parsing of malformed .npy headers numpy reader (#6380)
- Added missing validation for COCO annotation bbox size (#6360)
- Improved validation/error reporting for batch permutation in ndd (#6359)
- Fixed validation for all operands residing on the same device in ndd (#6347)
- Fixed handling of scalar-like values with new NumPy. (#6331)
- Fixed memory leak when accessing Python attributes of Tensor/TensorList (
data_ptr,stream,__(cuda_)array_interface__["data"]) (#6322) - Fixed per-sample tensor_resize argument handling (#6318)
- Ensured consistent reporting of empty layouts in ndd (#6304)
- Fixed handling of NVML_ERROR_NOT_SUPPORTED on partial-NVML platforms (#6296)
Improvements
- Update VERSION to 2.2.0
- Port libsound fixes (#6384)
- Accept constant local variables as arguments with compile=True (#6382)
- [Torchvision API] Remove Torchvision's dependency - InterpolationMode (#6383)
- Improved NDD skills (#6376)
- Torchvsion API documentation page update (#6313)
- Document that the dali-dynamic-mode skill exists (#6358)
- [Torchvision API] resized_crop and RandomResizedCrop (#6369)
- Add more Python-related leak suppressions. (#6370)
- Update video decoder & reader supported format list (#6377)
- [Torchvision API] Input metadata (#6364)
- Make skills/ the source of truth for skills (#6375)
- Move to CUDA 13.3 (#6371)
- Add checkpointing examples and skill. (#6368)
- Add NVSkills CI workflow (#6374)
- [Torchvision API] crop (#6353)
- Reenable 1ch torchvision grayscale test (#6372)
- Include reader in pipelines in transparent pipelining (#6357)
- Hide WorkerThread implementation details (#6362)
- Restore default hw_decoder_load to 0.65 in imgcodec decoder (#6366)
- Document dynamic operator wrapper arguments (#6363)
- Deps update/2026 05 14 (#6351)
- Improve DLPack support for external tensor consumption (#6261)
- Bump DALI_DEPS_VERSION (#6356)
- Drop opencv_imgcodecs from libdali (#6349)
- Convert numpy types to DALIDataType (#6350)
- Update DALI dependencies to include security hardening in the build script. (#6346)
- Update QA package versions for Python 3.14 (#6330)
- Improve call site resolution (#6323)
- Rename DALI dynamic mode skill and move to .agents directory (#6328)
- Use upstream FFmpeg in Conda builds (#6345)
- Torchvision API RandomApply implementation (#6342)
- imgcodec: work around nvImageCodec ROI/orientation contract bug (#6344)
- test: disable HW JPEG decoder in free-threading multithreading test (#6343)
- Dynamic Mode checkpointing (#6340)
- Source nvImageCodec, OpenCV, and libjpeg-turbo from conda-forge (#6315)
- Exclude
- Improved DALI dynamic:
- v2.1.1DALI v2.1.12026-06-15 · 2026-06-15 18:55 UTC
查看更新说明
Key Features and Enhancements
There are no new features in this release
Fixed Issues
- Updated CPU-based media support (#6352)
Bug Fixes
- Bump up DALI version to 2.1.1
- Fix DALI build with Clang 21 (#6348)
- Update CPU-based media support (#6352)
- Fix Outdated GitHub Links and Hardcoded Artifacts (#6365)
- Fix generated docs see also links (#6355)
- Fix docs version selector paths for DALI 2.x (#6354)
Breaking API changes
There are no breaking changes in this DALI release.
Deprecated features
No features were deprecated in this release.
Known issues:
- In some cases, the pass-through parallel external source outputs may be corrupted when used with pipelined dynamic executor. The issue occurs when all four conditions are met: 1. the pipeline uses dynamic executor
exec_dynamic=True(default), 2. theexternal_sourceruns in parallel mode (parallel=True), 3. the ES output is directly returned from the pipeline, 4. the ES output is a single contiguous chunk of memory (eitherbatch=Trueorbatch_size=1). Currently, as a workaround, user can specifyexec_dynamic=Falsewhen instantiating pipeline or add an extrafn.copyto prevent directly returning ES outputs from the pipeline. - A problem with insufficient static TLS allocation size has been observed on Ubuntu 22.04 for aarch64 that can result in process crash when loading dynamic libraries. Updating glibc to 2.39 or newer, or specifying higher static TLS size with
GLIBC_TUNABLES=glibc.rtld.optional_static_tls=10000should resolve the issue. - The following operators:
experimental.readers.fits,experimental.decoders.video, andexperimental.inputs.videodo not currently support checkpointing. - The video loader operator requires that the key frames occur, at a minimum, every 10 to 15 frames of the video stream.
If the key frames occur at a frequency that is less than 10-15 frames, the returned frames might be out of sync. - Experimental VideoReaderDecoder does not support open GOP.
It will not report an error and might produce invalid frames. VideoReader uses a heuristic approach to detect open GOP and should work in most common cases. - The DALI TensorFlow plugin might not be compatible with TensorFlow versions 1.15.0 and later.
To use DALI with the TensorFlow version that does not have a prebuilt plugin binary shipped with DALI, make sure that the compiler that is used to build TensorFlow exists on the system during the plugin installation. (Depending on the particular version, you can use GCC 4.8.4, GCC 4.8.5, or GCC 5.4.) - In experimental debug and eager modes, the GPU external source is not properly synchronized with DALI internal streams. As a workaround, you can manually synchronize the device before returning the data from the callback.
- Due to some known issues with meltdown/spectra mitigations and DALI, DALI shows best performance when running in Docker with escalated privileges, for example:
privileged=yesin Extra Settings for AWS data points--privilegedor--security-opt seccomp=unconfinedfor bare Docker.
Binary builds
NOTE: DALI builds dynamically link the CUDA toolkit. To use DALI, please install the latest (12.x or 13.x) CUDA toolkit.
DALI builds use CUDA toolkit enhanced compatibility: DALI is built with the latest CUDA 12.x/13.x toolkit but can be run on any stable drivers from the respective CUDA family (525 and 580). Using the most recent driver may enable additional functionality. More details can be found in enhanced CUDA compatibility guide.Install via pip for CUDA 13.0:
pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/ nvidia-dali-cuda130==2.1.1pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/ nvidia-dali-tf-plugin-cuda130==2.1.1or just:
`pip
- v2.1.0DALI v2.1.02026-04-28 · 2026-04-28 18:16 UTC
查看更新说明
Key Features and Enhancements
This DALI release includes the following key features and enhancements:
- Added torchvision API:
- Enabled composing DALI pipelines with torchvision-like API (#6281, #6278, #6276, #6275, #6272, #6266, #6229)
- Added utilities for torch tensor/PIL image conversions (#6287)
- Improved DALI dynamic:
- Added new thread pool for better threads utilization and sharing across process (#4635, #6219, #6245, #6224, #6254)
- Improved error-reporting (#6210, #6260)
- Improved deletion order handling to avoid unnecessary syncs (#6277)
- Improved readers API (#6252)
- Improved video readers:
- Added uniform_sample option to VideoReaderDecoder (#6258)
- Added enable_frame_num='sequence' mode to video readers. (#6237)
- Improved free-threaded Python support:
- Support free-threaded Python in DALI python_function (#6289)
- Replaced dm-tree with optree dependency (#6225)
- Added support for CUDA 13.2 (#6249)
- Added support for instantiating operators and building pipelines in C API (#6253)
- Updated JAX integration to support JAX 0.9. (#6238, #6286, #6259, #6256, #6247)
Fixed Issues
- Documented workaround for CUDA graph capture clash between JAX and DALI (#6286)
- Fixed out-of-bounds access and key handling in Caffe/Caffe2 reader (#6211)
- Fixed range clamping in subscript operator. (#6242)
- Fixed too strict contiguity check when importing tensors via DLPack (#6285)
- Fixed inflate operator max output estimation (#6283)
Improvements
- Update DALI_DEPS_VERSION (patch libtiff) (#6295)
- Torchvision API to tensor/PIL image conversion operators (#6282)
- Allow passing tensor arguments in reader constructors (#6252)
- Update third-party dependencies (2026-04-09) (#6287)
- Declare free-threaded Python support on the python_function plugin (#6289)
- Torchvision API documentation (#6281)
- Update VERSION to 2.1.0
- Move dynamic API class constructor docs to class-level docstrings (#6273)
- Torchvision normalize (#6278)
- Pipeline building in C API (#6253)
- Torchvision padding (#6276)
- Torchvision gaussian blur (#6275)
- Torchvision API - ColorJitter and Grayscale operators (#6272)
- Add uniform_sample option to VideoReaderDecoder (#6258)
- Torchvision API - center crop operator (#6266)
- Add quiet argument to RandomBBoxCrop to suppress crop failure warning (#6270)
- Fix Coverity detected defects (#6257)
- Improve deadsnakes PPA key handling in aarch64-linux Dockerfile (#6268)
- Use NewThreadPool in dynamic mode. Use only one default instance of ThreadPool per device. (#6254)
- Change a way deadsnakes ppa is accessed (#6263)
- Torchvision API infrastructure (#6229)
- New ThreadPool + thread pool facade (#6224)
- Make result of AtScopeExit non-discardable. (#6248)
- Move to CUDA 13.2 (#6249)
- Add an ability to skip in-test timestamps (#6250)
- Update third-party dependencies (2026.03) (#6243)
- Add enable_frame_num='sequence' mode to video readers. (#6237)
- Update JAX plugin to JAX 0.9. (#6238)
- Add non-cooperative jobs to new ThreadPool (#6245)
- Add shuffle_after_epoch_seed argument to file-based readers. (#6236)
- Add numpy missing dependency to TL1_custom_src_pattern_build (#6240)
- Set
TensorListdeletion order inset_orderwhen possible (#6235) - Improve NDD operator filtering. (#6239)
- Add numpy as an explicit conda dependency for dali_python_bindings (#6232)
- Remove experimental C++ API documentation page. (#6230)
- Rework NVTX annotations in dynamic mode (#6227)
- Replace dm-tree with optree (#6225)
- Add dump_artifacts flag to avoid dumping artifacts for expected test failures (#6223)
- Improve nvcomp header detection for dynamic nvcomp builds (#6226)
- Raise exceptions when an EvalContext is active in multiple threads (#6221)
- Cleanup after instance cache rework. (#6209)
- Remove start_immediately parameter from AddWork. (#6219)
- Remove python tests with forced new executor. (#6222)
- Added torchvision API:
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
|License| |Documentation| |Format|
NVIDIA DALI
.. overview-begin-marker-do-not-remove
The NVIDIA Data Loading Library (DALI) is a GPU-accelerated library for data loading and pre-processing to accelerate deep learning applications. It provides a collection of highly optimized building blocks for loading and processing image, video and audio data. It can be used as a portable drop-in replacement for built in data loaders and data iterators in popular deep learning frameworks.
Deep learning applications require complex, multi-stage data processing pipelines that include loading, decoding, cropping, resizing, and many other augmentations. These data processing pipelines, which are currently executed on the CPU, have become a bottleneck, limiting the performance and scalability of training and inference.
DALI addresses the problem of the CPU bottleneck by offloading data preprocessing to the GPU. Additionally, DALI relies on its own execution engine, built to maximize the throughput of the input pipeline. Features such as prefetching, parallel execution, and batch processing are 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 code maintainability. Data processing pipelines implemented using DALI are portable because they can easily be retargeted to TensorFlow, PyTorch, and PaddlePaddle.
.. image:: /dali.png :width: 800 :align: center :alt: DALI Diagram
.. github display off
.. GitHub discards custom styles when rendering Markdown. We can use it to our advantage to hide the GitHub-style admonition in the sphinx-rendered documentation
.. only:: html
.. raw:: html
<style>
.github-only {
display: none !important;
}
</style>
.. rst-class:: github-only .. pull-quote::
[!TIP]
The `dali-dynamic-mode <https://github.com/NVIDIA/skills/blob/main/skills/dali-dynamic-mode/SKILL.md>`_ skill
provides AI agents with guidance on the Dynamic Mode API and best practices. It can be installed as follows:
.. code-block:: sh
npx skills add nvidia/skills --skill dali-dynamic-mode
For more information, see the `NVIDIA/skills <https://github.com/NVIDIA/skills>`_ GitHub repository.
DALI in action
.. container:: dali-tabs
Pipeline mode:
.. code-block:: python
from nvidia.dali.pipeline import pipeline_def
import nvidia.dali.types as types
import nvidia.dali.fn as fn
from nvidia.dali.plugin.pytorch import DALIGenericIterator
import os
# To run with different data, see documentation of nvidia.dali.fn.readers.file
# points to https://github.com/NVIDIA/DALI_extra
data_root_dir = os.environ['DALI_EXTRA_PATH']
images_dir = os.path.join(data_root_dir, 'db', 'single', 'jpeg')
def loss_func(pred, y):
pass
def model(x):
pass
def backward(loss, model):
pass
@pipeline_def(num_threads=4, device_id=0)
def get_dali_pipeline():
images, labels = fn.readers.file(
file_root=images_dir, random_shuffle=True, name="Reader")
# decode data on the GPU
images = fn.decoders.image_random_crop(
images, device="mixed", output_type=types.RGB)
# the rest of processing happens on the GPU as well
images = 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())
return images, labels
train_data = DALIGenericIterator(
[get_dali_pipeline(batch_size=16)],
['data', 'label'],
reader_name='Reader'
)
for i, data in enumerate(train_data):
x, y = data[0]['data'], data[0]['label']
pred = model(x)
loss = loss_func(pred, y)
backward(loss, model)
Dynamic mode:
.. code-block:: python
import os
import nvidia.dali.types as types
import nvidia.dali.experimental.dynamic as ndd
import torch
# To run with different data, see documentation of ndd.readers.File
# points to https://github.com/NVIDIA/DALI_extra
data_root_dir = os.environ['DALI_EXTRA_PATH']
images_dir = os.path.join(data_root_dir, 'db', 'single', 'jpeg')
def loss_func(pred, y):
pass
def model(x):
pass
def backward(loss, model):
pass
reader = ndd.readers.File(file_root=images_dir, random_shuffle=True)
for images, labels in reader.next_epoch(batch_size=16):
images = ndd.decoders.image_random_crop(images, device="gpu", output_type=types.RGB)
# the rest of processing happens on the GPU as well
images = ndd.resize(images, resize_x=256, resize_y=256)
images = ndd.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=ndd.random.coin_flip(),
)
x = torch.as_tensor(images)
y = torch.as_tensor(labels.gpu())
pred = model(x)
loss = loss_func(pred, y)
backward(loss, model)
Highlights
- 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 with
GPUDirect Storage <https://developer.nvidia.com/gpudirect-storage>__. - Easy integration with
NVIDIA Triton Inference Server <https://developer.nvidia.com/nvidia-triton-inference-server>__ withDALI TRITON Backend <https://github.com/triton-inference-server/dali_backend>__. - Open source.
.. overview-end-marker-do-not-remove
DALI success stories:
During Kaggle computer vision competitions <https://www.kaggle.com/code/theoviel/rsna-breast-baseline-faster-inference-with-dali>:"DALI is one of the best things I have learned in this competition" <https://www.kaggle.com/competitions/rsna-breast-cancer-detection/discussion/391059>Lightning Pose - state of the art pose estimation research model <https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10168383/>__To improve the resource utilization in Advanced Computing Infrastructure <https://arcwiki.rs.gsu.edu/en/dali/using_nvidia_dali_loader>__MLPerf - the industry standard for benchmarking compute and deep learning hardware and software <https://developer.nvidia.com/blog/mlperf-hpc-v1-0-deep-dive-into-optimizations-leading-to-record-setting-nvidia-performance/>__"we optimized major models inside eBay with the DALI framework" <https://www.nvidia.com/en-us/on-demand/session/gtc24-s62578/>__
DALI Roadmap
The following issue represents <https://github.com/NVIDIA/DALI/issues/5320>__ a high-level overview of our 2024 plan. You should be aware that this
roadmap 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 mentioned GitHub issue.
Installing DALI
To install the latest DALI release for the latest CUDA version (12.x)::
pip install nvidia-dali-cuda120
# or
pip install --extra-index-url https://pypi.nvidia.com --upgrade nvidia-dali-cuda120
DALI requires NVIDIA driver <https://www.nvidia.com/drivers>__ supporting the appropriate CUDA version.
In case of DALI based on CUDA 12, it requires CUDA Toolkit <https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html>__
to be installed.
DALI comes preinstalled in the TensorFlow <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tensorflow>,
PyTorch <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch>,
and PaddlePaddle <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/paddlepaddle>__
containers on NVIDIA GPU Cloud <https://ngc.nvidia.com>__.
For other installation paths (TensorFlow plugin, older CUDA version, nightly and weekly builds, etc),
and specific requirements please refer to the Installation Guide <https://docs.nvidia.com/deeplearning/dali/user-guide/docs/installation.html>__.
To build DALI from source, please refer to the Compilation Guide <https://docs.nvidia.com/deeplearning/dali/user-guide/docs/compilation.html>__.
Examples and Tutorials
An introduction to DALI can be found in the Getting Started <https://docs.nvidia.com/deeplearning/dali/user-guide/docs/examples/getting_started.html>__ page.
More advanced examples can be found in the Examples and Tutorials <https://docs.nvidia.com/deeplearning/dali/user-guide/docs/examples/index.html>__ page.
For an interactive version (Jupyter notebook) of the examples, go to the docs/examples <https://github.com/NVIDIA/DALI/blob/main/docs/examples>__
directory.
Note: Select the Latest Release Documentation <https://docs.nvidia.com/deeplearning/dali/user-guide/docs/index.html>__
or the Nightly Release Documentation <https://docs.nvidia.com/deeplearning/dali/main-user-guide/docs/index.html>__, which stays in sync with the main branch,
depending on your version.
Additional Resources
- GPU Technology Conference 2024; Optimizing Inference Model Serving for Highest Performance at eBay; Yiheng Wang:
event <https://www.nvidia.com/en-us/on-demand/session/gtc24-s62578/>__ - GPU Technology Conference 2023; Developer Breakout: Accelerating Enterprise Workflows With Triton Server and DALI; Brandon Tuttle:
event <https://www.nvidia.com/en-us/on-demand/session/gtcspring23-se52140/>__. - GPU Technology Conference 2023; GPU-Accelerating End-to-End Geospatial Workflows; Kevin Green:
event <https://www.nvidia.com/en-us/on-demand/session/gtcspring23-s51796/>__. - GPU Technology Conference 2022; Effective NVIDIA DALI: Accelerating Real-life Deep-learning Applications; Rafał Banaś:
event <https://www.nvidia.com/en-us/on-demand/session/gtcspring22-s41442/>__. - GPU Technology Conference 2022; Introduction to NVIDIA DALI: GPU-accelerated Data Preprocessing; Joaquin Anton Guirao:
event <https://www.nvidia.com/en-us/on-demand/session/gtcspring22-s41443/>__. - GPU Technology Conference 2021; NVIDIA DALI: GPU-Powered Data Preprocessing by Krzysztof Łęcki and Michał Szołucha:
event <https://www.nvidia.com/en-us/on-demand/session/gtcspring21-s31298/>__. - GPU Technology Conference 2020; Fast Data Pre-Processing with NVIDIA Data Loading Library (DALI); Albert Wolant, Joaquin Anton Guirao:
recording <https://developer.nvidia.com/gtc/2020/video/s21139>__. - GPU Technology Conference 2019; Fast AI data pre-preprocessing with DALI; Janusz Lisiecki, Michał Zientkiewicz:
slides <https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9925-fast-ai-data-pre-processing-with-nvidia-dali.pdf>,recording <https://developer.nvidia.com/gtc/2019/video/S9925/video>. - GPU Technology Conference 2019; Integration of DALI with TensorRT on Xavier; Josh Park and Anurag Dixit:
slides <https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9818-integration-of-tensorrt-with-dali-on-xavier.pdf>,recording <https://developer.nvidia.com/gtc/2019/video/S9818/video>. - GPU Technology Conference 2018; Fast data pipeline for deep learning training, T. Gale, S. Layton and P. Trędak:
slides <http://on-demand.gputechconf.com/gtc/2018/presentation/s8906-fast-data-pipelines-for-deep-learning-training.pdf>,recording <https://www.nvidia.com/en-us/on-demand/session/gtcsiliconvalley2018-s8906/>. Developer Page <https://developer.nvidia.com/DALI>__.Blog Posts <https://developer.nvidia.com/blog/tag/dali/>__.
Contributing to DALI
We welcome contributions to DALI. To contribute to DALI and make pull requests,
follow the guidelines outlined in the Contributing <https://github.com/NVIDIA/DALI/blob/main/CONTRIBUTING.md>__
document.
If you are looking for a task good for the start please check one from
external contribution welcome label <https://github.com/NVIDIA/DALI/labels/external%20contribution%20welcome>__.
Reporting Problems, Asking Questions
We appreciate feedback, questions or bug reports. When you need help
with the code, follow the process outlined in the Stack Overflow <https://stackoverflow.com/help/mcve>__ document. Ensure that the
posted 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 we can dedicate to the fixes.
- verifiable: Test the code you are about to provide, to make sure that it reproduces the problem. Remove all other problems that are not related to your request.
Acknowledgements
DALI was originally built with major contributions from Trevor Gale, Przemek Tredak, Simon Layton, Andrei Ivanov and Serge Panev.
.. |License| image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg :target: https://opensource.org/licenses/Apache-2.0
.. |Documentation| image:: https://img.shields.io/badge/NVIDIA%20DALI-documentation-brightgreen.svg?longCache=true :target: https://docs.nvidia.com/deeplearning/dali/user-guide/docs/index.html
.. |Format| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black