Skip to main content

Megatron's multi-modal data loader

Megatron Energon

Tests Documentation
Report Bug · Request Feature


DISCLAIMER: This package contains research code. APIs may change.

What is this?

Megatron Energon is the multi-modal data loader of Megatron (you can also use it independently).

It's best at

  • loading large training data to train large multi-modal models
  • blending many different datasets together
  • distributing the work across many nodes and processes of a cluster
  • ensuring reproducibility and resumability
  • adapting easily to various types of data samples and processing

Try using it together with Megatron Core.

Quickstart

Megatron Energon is a pip-installable python package that offers

  • dataset-related classes that you can import in your project
  • a command line utility for data preprocessing and conversion

This document is just a quick start. Please also check out the documentation.

Installation

To install the latest stable version:

pip install megatron-energon

Or to install the current development version:

pip install git+https://github.com/NVIDIA/Megatron-Energon.git

NOTE: We encourage you to install the package (and not just import a local copy). This will ensure you have all the needed dependencies and that you can use the command line tool.

For more details on installing this package, see here.

Usage of command line tool

After installation, the command energon will be available.

Here are some examples for things you can do:

Command Description
energon prepare DATASET_ROOT Take an existing WebDataset and add the required yaml files to turn it into an energon-compatible dataset
energon lint DATASET_ROOT Verify that the dataset complies with the energon dataset format and that all samples are loadable

Usage of the library

To get started, pick a WebDataset-compliant dataset and run energon prepare DATASET_ROOT on it, to run the interactive assistant and create the .nv-meta folder. As an alternative to WebDataset, Energon also supports the JSONL format, see here.

Once done, try to load it from your Python program:

from megatron.energon import get_train_dataset, get_loader, WorkerConfig


simple_worker_config = WorkerConfig(rank=0, world_size=1, num_workers=2)


train_ds = get_train_dataset(
    '/my/dataset/path',
    batch_size=2,
    shuffle_buffer_size=None,
    max_samples_per_sequence=None,
    worker_config=simple_worker_config,
)

train_loader = get_loader(train_ds)

for batch in train_loader:
    # Do something with batch
    # Infer, gradient step, ...
    pass

For more details, read the documentation.

Metadata

Release files for megatron-energon 7.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for megatron-energon 7.4.1
File Size Uploaded Provenance Actions
megatron_energon-7.4.1.tar.gz 211.3 kB With provenance Details for megatron_energon-7.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for megatron-energon 7.4.1
File Interpreter ABI Platform Actions
megatron_energon-7.4.1-py3-none-any.whl Python 3 none any Details for megatron_energon-7.4.1-py3-none-any.whl

Total release size: 498.1 kB

Release files / megatron_energon-7.4.1.tar.gz

Download URL megatron_energon-7.4.1.tar.gz
Size 211.3 kB
Tags Source
SHA-256 checksum
How to use checksums
31e5511bf894e235dff35dacbe130fb1283010a132b612c07e3fa841cc37d82c
BLAKE2b-256 checksum
How to use checksums
81151aa34071dbb64c30f56c68b78989e2a3f11ce72583466b98b37a04206ad4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release files / megatron_energon-7.4.1-py3-none-any.whl

Download URL megatron_energon-7.4.1-py3-none-any.whl
Size 286.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2d96756f2825750bf51a2b2c16bd1ddfed8f50414b72bb9da174dd8ddafb7d8
BLAKE2b-256 checksum
How to use checksums
9121fcfffd2dbc8523412ac623da5e24096a252ff6342f97e1bddf3cce99e36e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Security for megatron-energon 7.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for megatron_energon-7.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page