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.19.dev20261113

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

Total release size: 9.0 MB

Release files / grain_nightly-0.2.19.dev20261113-cp314-cp314-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp314-cp314-win_amd64.whl
Size 538.8 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
a004103e004265a66fbc9d415f1867e419ccf0c4e86b69cda8b3e5c9b1483c6b
BLAKE2b-256 checksum
How to use checksums
032f7edbd5a0a8d0347dc29fbc3b41e226c7b88bfa9d4f8bf7eb4612b844242e
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.19.dev20261113-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.2 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1ad2bf429fca6711e0a57c1a3f3787f7d6917f0ca2b6a913e9130bdd70bdeeb2
BLAKE2b-256 checksum
How to use checksums
3bf6967631039f9c38e853ed7b10c71c6a747bf8ccc9d7a67f42e48d26572ebd
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.19.dev20261113-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 592.0 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
eaf00fa0235da1da1da7a4642246214e235ca019038c0169deec79960cb1f2ee
BLAKE2b-256 checksum
How to use checksums
0ca87b2e1497590405861063cb2179714474fe9b19f5a9c44eab4600071553e2
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.19.dev20261113-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp314-cp314-macosx_11_0_arm64.whl
Size 535.5 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f2a6346642881f57284ff4d7039a17ab9c3b12cf33ba4a312e212c8734052a23
BLAKE2b-256 checksum
How to use checksums
35d81bbd6994fab5bc61cf6c9a9c68b048e4a985904beff6c76133f42a5b0b5a
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.19.dev20261113-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp313-cp313-win_amd64.whl
Size 532.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
11d5d8c74255b680dc4ab69319188d0f67c55a7f62d99ea37b28827591488a3c
BLAKE2b-256 checksum
How to use checksums
099caee71b47548b8a800ed217f551bef61e05f0a1ecd23a37bde02039f76f9e
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.19.dev20261113-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.1 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6b2acea15597a85f1d2442d9c49d1daec9adea2bf167cd915d7373aea5602dcc
BLAKE2b-256 checksum
How to use checksums
eec2c673761a04752001f08ebadea78f726fdcea72f005c5e90c8a195397214e
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.19.dev20261113-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 591.9 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5c76af59ada163b46cf060f386b6ee1e3c9550a1cbdd93628833a2e7e3243ede
BLAKE2b-256 checksum
How to use checksums
ee7338c58a7cc27bfd67bcc6879a03ac09629f7ae8b945f64c24e4eacd6c40df
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.19.dev20261113-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp313-cp313-macosx_11_0_arm64.whl
Size 535.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5eaf8f8104f504055843dde13ac4dbc4e463217becc4c0e2003a492baaaecc16
BLAKE2b-256 checksum
How to use checksums
737fd534ee153a4e4cfedcab69ed6b4d00854b4043a773db25e6136eb66198fa
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.19.dev20261113-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp312-cp312-win_amd64.whl
Size 532.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
64b7ca437beb715f6b5575266b05d671996f8b74bd3b1009020072c5e8cce7dc
BLAKE2b-256 checksum
How to use checksums
63192a600ac7eb4583160b8757cf451a063616bd59c5c525434b9502c959e3f4
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.19.dev20261113-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.0 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b211fc1043c701792564b6631393cf6aa755ebb1cd870d8c79b1021a0c2e25e4
BLAKE2b-256 checksum
How to use checksums
0536ba4a0ca29a5058e773e479ee5de783b67e080e6da10348df8fa4902e5dea
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.19.dev20261113-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 591.9 kB
Tags CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
f3369976bc1f11908d2a6409ba2d1e3b937b6558089f787584449c42f40ea855
BLAKE2b-256 checksum
How to use checksums
bdee8dffbb954000565c93410312b58ac0a73ed68d7a5bf12e82f42c8cdd203e
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.19.dev20261113-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp312-cp312-macosx_11_0_arm64.whl
Size 535.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6bb00247edee89073e900649fc1df60d45adf6745f32516d632d0e41c717e894
BLAKE2b-256 checksum
How to use checksums
3fd5fb46fbd5f3631741b603bbe06e9ea54e8b9173e18506f1bff722e2c4d974
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.19.dev20261113-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp311-cp311-win_amd64.whl
Size 532.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
1420b48abc8bbd5c28c84496645e3a408a8811e7c91a5bb47a7b698da4609b85
BLAKE2b-256 checksum
How to use checksums
b014203e627b1524d02db0ed9e651fbedf48e64c614457592d0997d548b26986
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.19.dev20261113-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 594.9 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
eb9ff558ecd4f19fd99adcac3ed06a1d650fc115d425dd38bc125506cd0fb728
BLAKE2b-256 checksum
How to use checksums
820d5a5f17d071535893f3fa3108d65ccece68d1210dd4565d6a161efa675e58
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.19.dev20261113-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 593.5 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
b9474677c0433a3e3f9fb7b4ea0cb131b302588c318b5eeb71429ed640763510
BLAKE2b-256 checksum
How to use checksums
c74d3f5126e477bb1997c98252f9139711c5c1eae77bb09a7d55b30c5970c2ce
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.19.dev20261113-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261113-cp311-cp311-macosx_11_0_arm64.whl
Size 537.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2435fbdfa3c71d92f8f11555bc58347fceadcc9e4df1510f9241f1607cfb510d
BLAKE2b-256 checksum
How to use checksums
f2cfbce7ede9d02ec2b6c70512c3d4f115deed6ce774dacfb3a400f1e1cafdfd
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.19.dev20261113

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