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.dev20261111

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

Total release size: 9.0 MB

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

Download URL grain_nightly-0.2.19.dev20261111-cp314-cp314-win_amd64.whl
Size 538.7 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
f798f827f0ae7397356ac6a3483353fee00c3d6957a2f89d7c2e3505be2a0405
BLAKE2b-256 checksum
How to use checksums
078a01ef0d60e67e2ccc23d6b05b2a295c8cc694614b5f0ebc7e3d7dc6f07bdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.1 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
57ce31ece2195c73b4fca2e3999fdff2bad9971f7a8a920a5afd7254ae674371
BLAKE2b-256 checksum
How to use checksums
077315c321afde0f6e3c18653b3881d14cee88c63a836f6d2022298c7a0380d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 591.9 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
44cd46ed2d3cd9540f61025c7f93872f285a067b7095e7d30948c32b88a13112
BLAKE2b-256 checksum
How to use checksums
fe6e5089dfd8cd87dc4874291c99eded7635dc6e2fc44dc609c0d5dd6d1e759b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261111-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
dc6ed2be0c56a709c73ad38d550ac2290264722a3640aaa39ab9737f6ac88f4c
BLAKE2b-256 checksum
How to use checksums
cd26fddfb678a79c164b8efa453efec1c05d75bad0e007dfd9fa736c9f637e9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp313-cp313-win_amd64.whl
Size 532.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b647f663af60e343ff9d33933781c28379ec8dedc9793a55e791f669b37242ee
BLAKE2b-256 checksum
How to use checksums
5e82311690a248642b287ec9a63b6dd8e2de8008259d7e397ae7cd1d455b9dce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.0 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e069cde82367366d01b03b099d58c0b4146150bd94ab18836ed9241f4013f628
BLAKE2b-256 checksum
How to use checksums
f00d1f5d8df3155e0522731f0488b161c5fbcdf8f63482dbb07cfa71394ad43c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 591.8 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
f1ce615334abd0cad243e6d848f297fbbd94fbe81f96355a21232819ba974c27
BLAKE2b-256 checksum
How to use checksums
ca2f6658c1ee376db5088acf0bb107dc9894d9f18be34a90e71227a196375a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261111-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
1a074a8d9b766a37d7ede67cbbebe9e070ee6f3355f0d00e99bb139e0839ba82
BLAKE2b-256 checksum
How to use checksums
5f2ba3f7d3f5d7ab7ffc015d15797f378e6a1f6657eb91f6051168121f763d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp312-cp312-win_amd64.whl
Size 532.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
93bb939a71340e9405fd6507b58f7c4c85acac19d7fe16b13a4d06b715aaad4a
BLAKE2b-256 checksum
How to use checksums
a10e3ad84df156cd4b828351e9b9fb84e9116d987951a688f44bc54bb812a7c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 592.9 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8528c457b384b9c9a244112beff721b88a10473644c2033d29ec5dbf794fb483
BLAKE2b-256 checksum
How to use checksums
352e2eb54c192bf5ce1a6061e3be7956fca27d6564c2c9bf3b841be819e6d9fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 591.7 kB
Tags CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4426ff02fc492b5a0db1fe169b843139914f13eb6486c58eff33b8afdd39ced3
BLAKE2b-256 checksum
How to use checksums
17a9e446e36a1a593ce97364a770541fef28424ce88dc5fee63562a8277be7ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261111-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
363c35eac202e73aaee603f148b55cfb6981024eea2fb15f49bc9be1d5d24a78
BLAKE2b-256 checksum
How to use checksums
6fdb03af14e53ab6b8bdde97d92fd159fe69dd6274814b1939759dfe91de6e6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp311-cp311-win_amd64.whl
Size 532.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9ba7549355b27f45e700c41e722a9ec764a8ff7540935d59b4e39b90c139c473
BLAKE2b-256 checksum
How to use checksums
d1fa238a4dee298c032dd9dd23bdb63eb85c30f0d5263a11922c3f4036de70f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 594.8 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
edd2e15d4c90a07da6760b9e4db07abea23458fb0b1a09c9885829f7e4ecc7ce
BLAKE2b-256 checksum
How to use checksums
e94b9de5f75f462817f94ba95573ffdd30aa0cae66c34a698df56d6adc9b7399
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261111-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 593.3 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
498b7785ead168757f59674a2b093cf4510634fa9a9194d6f8bfa7f742a0ea83
BLAKE2b-256 checksum
How to use checksums
754e8e7bc5121f0bae5b154f68c69a55e1e9e01e1c7fd691afec23c8cae24725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.19.dev20261111-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261111-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
f7e90dc16b7b57cdae73128c6b8f5248ec0a10a5050621ab733c24c42d9122a9
BLAKE2b-256 checksum
How to use checksums
ee42fd26b46e21b297a611c9a0f31eadea483f85c41def5998bb6cd6ee4a8b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Security for grain-nightly 0.2.19.dev20261111

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