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 yes
aarch64 yes yes n/a

Quickstart

Citing Grain

To cite this repository:

@software{grain2023github,
  author = {Marvin Ritter and Ihor Indyk and Aayush Singh and Andrew Audibert and Anoosha Seelam and Camelia Hanes and Eric Lau and Jacek Olesiak and Jiyang Kang and Xihui Wu},
  title = {{Grain} - Feeding JAX Models},
  url = {http://github.com/google/grain},
  version = {0.2.12},
  year = {2023},
}

The version number is intended to be that from pyproject.toml, and the year corresponds to the project's open-source release.

Existing users

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

Metadata

Release files for grain-nightly 0.2.20.dev20261117

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.20.dev20261117
File Actions
grain_nightly-0.2.20.dev20261117-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for grain_nightly-0.2.20.dev20261117-cp314-cp314-win_amd64.whl
grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
grain_nightly-0.2.20.dev20261117-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp314-cp314-macosx_11_0_arm64.whl
grain_nightly-0.2.20.dev20261117-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for grain_nightly-0.2.20.dev20261117-cp313-cp313-win_amd64.whl
grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
grain_nightly-0.2.20.dev20261117-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp313-cp313-macosx_11_0_arm64.whl
grain_nightly-0.2.20.dev20261117-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for grain_nightly-0.2.20.dev20261117-cp312-cp312-win_amd64.whl
grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
grain_nightly-0.2.20.dev20261117-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp312-cp312-macosx_11_0_arm64.whl
grain_nightly-0.2.20.dev20261117-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for grain_nightly-0.2.20.dev20261117-cp311-cp311-win_amd64.whl
grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64, Linux glibc 2.24+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
grain_nightly-0.2.20.dev20261117-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for grain_nightly-0.2.20.dev20261117-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 9.8 MB

Release files / grain_nightly-0.2.20.dev20261117-cp314-cp314-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp314-cp314-win_amd64.whl
Size 587.2 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
cd1a9dfcb3edabbb9716534cbb1661423eb0ed10847ba1dc1ab35c0405dac458
BLAKE2b-256 checksum
How to use checksums
7e515c5de57ead15f6fa7f9f9e5d1c258f2b27e08f18a34002db6aa35827e4e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 641.4 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4a2aa04512f0617f5e0e8194ae7ae493b7a378be33094abe097467c1e43bce43
BLAKE2b-256 checksum
How to use checksums
56d6876a6c9e257f79379b02e08dcc83918becad34b6fd1e3f03668bd0084556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 640.3 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4d460d380a8f9f173e2195e9ef0a9687b2c7447d8d4174b5f7bac2c8f3d0b14a
BLAKE2b-256 checksum
How to use checksums
227be698946729745ad3305e40f0c5f3538efa215fa0660f5cba075d6697ab7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp314-cp314-macosx_11_0_arm64.whl
Size 583.6 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
41d9294a987f6f19fbc8a691fcb678d44ab1371683b33fe99c5b1564b872b586
BLAKE2b-256 checksum
How to use checksums
37d50f1a27c19ae1a1639620647b8aebd6c3b4efc6cef1228bfa3f79c9ca338c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp313-cp313-win_amd64.whl
Size 581.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a33ad754086494fc4e4905d33990ca7e3fc8d20e76ad6ca1448d5d2f83d69dc6
BLAKE2b-256 checksum
How to use checksums
9a0175dd21ecded22975ff35010cec3ef4181a3cb0ee808f7a80697649b98160
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 641.4 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4417452ffdb94f4fffa99d3229e7eb014a63c9e12c9fe8c867decf5f15ba4b98
BLAKE2b-256 checksum
How to use checksums
0a79fc9b1d3516469e16e504400c7bc30e1b4c006822338e2484827bc6e2551f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 640.2 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
f1fa2daf9063b2bfe1cd39ef19c87ec506d0fea84202d20b92d86e3f1c1dfe63
BLAKE2b-256 checksum
How to use checksums
82862e5b66f7b8cd55892dac2210c584db1dfe02ef426c79a9c941f9e8b26f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp313-cp313-macosx_11_0_arm64.whl
Size 583.6 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
99dc58c74b6fd99ea8639d4d3d20234a8917e3d6114627d3aa77dba126bfdb9c
BLAKE2b-256 checksum
How to use checksums
da96eb1746bc307c6574f2ac5ccf69bdffe5a1f6b6ce64ea8c7ea02df38fcc70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp312-cp312-win_amd64.whl
Size 580.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f3989d5345a4477feb76bad85c51c9e9739f17456ac44b0817ffdf9274423323
BLAKE2b-256 checksum
How to use checksums
8852953f618cb46f3246998cb3f33a25821a937a99f216f706d45dd9ec0b7138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 641.2 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ec7c126f155b61058a9241c65f08cfee784654af935d51268caa456f1b9e2c8d
BLAKE2b-256 checksum
How to use checksums
2d9541af3ec16ba99f9c289780aad6f3d5d6ed4cad2e6da0f7bd6c1fde2d622c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 640.1 kB
Tags CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4bc8276c1e34551b196d2847ddc7c1ffb874fc8d7b89ca76eabb3020e53ca90d
BLAKE2b-256 checksum
How to use checksums
eb1a0279e191ec99b005a31f9ae365ca607f54f11fd78cb6a41fa9c48c2f1dd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp312-cp312-macosx_11_0_arm64.whl
Size 583.4 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
82acdce18758b2c746a94c6c8e1ca8269d7063295a54f5de8e41139f919baba1
BLAKE2b-256 checksum
How to use checksums
ff2e7b3b2cbba1a7f5cf14402f733335b156c771623d35f2e4d1b52ef2bdf934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp311-cp311-win_amd64.whl
Size 580.7 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
209ed369ae079c75a0da8e09b87bc5ec2090f0007e7879022211e1d3a4f1dada
BLAKE2b-256 checksum
How to use checksums
36a60994fb32a8f29b5b2c47d5bb87688225945b8f5d420ef7016f904e1bd25b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 643.2 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
135392337b832b028806c6e138f1770f6ad35c78d2858b1a3caa66d597a43f25
BLAKE2b-256 checksum
How to use checksums
68f0793c88795d2dbf2c4c0e2fafaa97a115330c0ed3634c396076462b16a0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 641.7 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
810abd59b5a87549853245e05a09c8a8d3399ee3169a35d7fb6d54e0c7c3b044
BLAKE2b-256 checksum
How to use checksums
0e775975287c3d4c882dd00acd2ef742f888e163e4997991cbd1f1f65e6d8be6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / grain_nightly-0.2.20.dev20261117-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261117-cp311-cp311-macosx_11_0_arm64.whl
Size 586.0 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c24600ff866c0286bafd2cad689bd3526cb3c24a6d4c0d82bd061678235b1723
BLAKE2b-256 checksum
How to use checksums
f8db459ce0764d8201d9cafe70799762d069cd6ba66d95f33df810d09769e755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for grain-nightly 0.2.20.dev20261117

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release
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