Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Grain - Feeding JAX Models

Continuous integration PyPI version

Installation | Quickstart | Reference docs | Change logs

Grain is a Python library for reading and processing data for training and evaluating JAX models. It is flexible, fast and deterministic.

Grain allows to define data processing steps in a simple declarative way:

import grain

dataset = (
    grain.MapDataset.source([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
    .shuffle(seed=42)  # Shuffles elements globally.
    .map(lambda x: x+1)  # Maps each element.
    .batch(batch_size=2)  # Batches consecutive elements.
)

for batch in dataset:
  # Training step.

Grain is designed to work with JAX models but it does not require JAX to run and can be used with other frameworks as well.

Installation

Grain is available on PyPI and can be installed with pip install grain.

Supported platforms

Grain does not directly use GPU or TPU in its transformations, the processing within Grain will be done on the CPU by default.

Linux Mac Windows
x86_64 yes no no
aarch64 yes yes n/a

Quickstart

Existing users

Grain is used by MaxText, Gemma, kauldron and multiple internal Google projects.

Metadata

Release files for grain-nightly 0.2.12.dev20250714

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

Built distributions (wheels)

Table of built distributions (wheels) for grain-nightly 0.2.12.dev20250714
File
grain_nightly-0.2.12.dev20250714-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.12.dev20250714-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.12.dev20250714-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.12.dev20250714-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.12.dev20250714-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.12.dev20250714-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 5.5 MB

Release files / grain_nightly-0.2.12.dev20250714-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 490.1 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6f788bab4d224179068149d5c878a258cce815e67d586ff727818e9586407ec3
BLAKE2b-256 checksum
How to use checksums
dd50917169fc703f7b775a5d186928231653c7872a1d006e62fbd69b4ff54492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 489.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
add11e8e5383ae8ad31448c63e127f92103c3ca38d22fc4b213c9fc6b4724c9b
BLAKE2b-256 checksum
How to use checksums
90ddc5858294b75a485f3e07e5844687ef0d4fbd5070c1b9a60fbef1a61a77b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp313-cp313-macosx_11_0_arm64.whl
Size 406.3 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b02fce45aa6a80c3f8ff461249c47ffc7347704cb5352f87585038ee3a728801
BLAKE2b-256 checksum
How to use checksums
340508e2106ada9ee0bb9bb3462c039d6ed438a34a2427ab92e7d28a3df0402b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 490.0 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1e508c6c3a47280ff235c2735b536c8f7479533916e7a8b1da2d55b64e3ceca0
BLAKE2b-256 checksum
How to use checksums
0a815ad7f50b96ec2bb0a59b68914f8bce9779632a4df8533a0512b15cf90f32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 488.9 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
f9a87831c93c5940b98b1bb5cfede6e66e980de2bdbaabf714070ca3cb81882f
BLAKE2b-256 checksum
How to use checksums
7e606adc5539bf26c47c0000c362138bc06ca8dd95702b0090950632ac284a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp312-cp312-macosx_11_0_arm64.whl
Size 406.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ab675847102d37a1c94dd9d61e799496359cf3c26360e1ae92b0001572541f25
BLAKE2b-256 checksum
How to use checksums
0d6a728e234d00051534af70f8871e3eee5a51bbdb0e434e8e6129af92351909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.6 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
59e3b7d7ada1a99f19ba016f35048450c14aa2c0f77a1de2a15dfe9fe6da2042
BLAKE2b-256 checksum
How to use checksums
3261f590bf6d88d8f5aefabbaf928073a49373bcf9151ebb161c0a390ea3b7ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.7 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
5ca7e54ea18cc96aeb44e3e1e3c6f1e5ef12811e9947adafd941d6b00bd295f1
BLAKE2b-256 checksum
How to use checksums
63dce11544552e991bae06d534aadcc7bda7c71d7099520bb6e2286990db8d20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp311-cp311-macosx_11_0_arm64.whl
Size 405.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3823ff6ba1844963a2d535064cba9d455c94e1319fcf5cfd9c14a27a32c12657
BLAKE2b-256 checksum
How to use checksums
5be8046026860bc80be6bf4bc002023e06928e97996cd8b6b7e9fc6f527d71be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7f534f69c17c522e1135706611f72630bcaf06a265b5943d18806e2cff3e67c0
BLAKE2b-256 checksum
How to use checksums
4771eeb6c4df3c3690daf05909a7aa45265c91a54c97e0998663cb6e51d88d5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.4 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ea76393f2ce10c10b963361d3bca4ebc7b1a857679bf430a516973fb02c48ad0
BLAKE2b-256 checksum
How to use checksums
7dea6d3b755dbc1ee6d67a2c362a9d281ddced03fd3d88191a30a499e9163c84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.12.dev20250714-cp310-cp310-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250714-cp310-cp310-macosx_11_0_arm64.whl
Size 405.2 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
95b2e30453653a2c551a2e13a0e47da23c01ffee7ee3930b58e8f258b2b24216
BLAKE2b-256 checksum
How to use checksums
89897d1d48898bf4365034eaffd109ad3a68645278ffe3d0a9f0d0e4af2c5e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

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