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

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.11.dev20250623

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.11.dev20250623
File
grain_nightly-0.2.11.dev20250623-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.11.dev20250623-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.11.dev20250623-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
grain_nightly-0.2.11.dev20250623-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.11.dev20250623-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.11.dev20250623-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
grain_nightly-0.2.11.dev20250623-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.11.dev20250623-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.11.dev20250623-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
grain_nightly-0.2.11.dev20250623-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.11.dev20250623-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.11.dev20250623-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.11.dev20250623-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.1 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d53e7a27eee438a95ac65dbd28ab22cfacb67f7500d3ed025b54c00626bb1b2e
BLAKE2b-256 checksum
How to use checksums
8d3eb68a1951a4ca2abb6a81324fd0d629e3e8823f6d36520af1d025e3f28812
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.11.dev20250623-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
50e9c28080147399ea30b31fc4c9794f2c32d7e27ba838204b77d1dd059e4884
BLAKE2b-256 checksum
How to use checksums
ffc5cb3df8216dfcf13c834196f7f0a01a0871cb2875ad86f4d8154c038f22d9
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.11.dev20250623-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp313-cp313-macosx_11_0_arm64.whl
Size 404.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1b72d935c1c1408b52b1cf2f2ea434fce6dd19898f99bba0137a3cc5adb82532
BLAKE2b-256 checksum
How to use checksums
3cde9eb3789181d81fdbe35b42a4df6c595665df05f5fccea9a03aebab65f67a
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.11.dev20250623-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.0 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
30c7fb99b5a7a51d7f48a5b2eced0e0ba640a6653321076e530e2852068e697f
BLAKE2b-256 checksum
How to use checksums
536ff2b10069af13c457b05482474645f0be5c6e0f92f056a8252029df8ff8d5
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.11.dev20250623-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 486.9 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
0b898f9f26d89384fd5ff6d6043fbc3da5ef1fa19c374bcbeb2b8bdf4ea845f1
BLAKE2b-256 checksum
How to use checksums
70faf47bff1e212a663d598679cf37c4de1e64c19518e187e23f2bfe2d0a5921
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.11.dev20250623-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp312-cp312-macosx_11_0_arm64.whl
Size 404.4 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fa752323ebab36a08a6a714a2320f3a30256b37c94288b49be94fcacebeb2d33
BLAKE2b-256 checksum
How to use checksums
36e6eb13a532e5a4ef1da377f0c37006516713c115d1b8e677aca5c854674418
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.11.dev20250623-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 486.6 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6a3f20e61669110bc650365a83dcad075d2ea394df4c28cb17bc335d050b5339
BLAKE2b-256 checksum
How to use checksums
93c3b6b961c8c6540e7ffcf107fc0958e6744bbb079645bc8288934d9cc8243f
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.11.dev20250623-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 485.7 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
0c8d019da59f8829262b6a89d28727782bd93968ad9a817c81e632fa25031401
BLAKE2b-256 checksum
How to use checksums
39a68ff5c67d3c70dc6cf79708e8b1cb7217bf37fcfa7fbb40d5323421f7c529
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.11.dev20250623-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp311-cp311-macosx_11_0_arm64.whl
Size 403.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f2a8050a8c223a32e4e698e02a811d19a8f6313fdeace51e6d0391ae18771f5e
BLAKE2b-256 checksum
How to use checksums
b07ba88ad34f86aea5dafd358963efcbe07a6d6daef52028cd5b3be2fd049662
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.11.dev20250623-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 486.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
392a3c1a93013d607fa9b9c7631af3c8a9f3832e20364f22e68602e55685caf4
BLAKE2b-256 checksum
How to use checksums
ce3ae661ba65167c761152a3d8f1ad4bef9edaec9da0649d54f3a2bdcf1826a1
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.11.dev20250623-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 485.4 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
8ef3f6a19f3b944c4e1f05caf6d5abf09be77e1cd335786d0f74942d5c3ed80d
BLAKE2b-256 checksum
How to use checksums
edfc0dcee884562b2f3ee79349218c16220137311391f6b6e64fce12e4ade9e6
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.11.dev20250623-cp310-cp310-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250623-cp310-cp310-macosx_11_0_arm64.whl
Size 403.4 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7fc61dac46ebd178188f4bb458936f80bcb13718158af8f2e92b9381856d0c20
BLAKE2b-256 checksum
How to use checksums
77cf73df613d7d7b99751f7a840a9629248bea1d41f0dfb3dcf5f95dea22e116
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