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

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

Total release size: 9.0 MB

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

Download URL grain_nightly-0.2.20.dev20261116-cp314-cp314-win_amd64.whl
Size 538.8 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
6a0e06e96585a45aff52c2d2847818bb0cb9a219054f7cf9b3801d9c63c279ed
BLAKE2b-256 checksum
How to use checksums
735b6b75e513773ec54116719469e27ad500b4b01908a619e21067d1a16153e1
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.dev20261116-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
65f766467802e0f814b2c0f82374bdfd7d6429bf51211f330dfcf81be3012811
BLAKE2b-256 checksum
How to use checksums
a849698ba7b65c1e744eaa14691ef6d4a8464f7b3a9190e72f969552eeef0c9b
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.dev20261116-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
22f78ccc6b8ea541aba4545431d10b65b7ae028e3cf4b6ca2a87eb61201a74b6
BLAKE2b-256 checksum
How to use checksums
c5866c71303eda70dd829206e521f9c55fd4d42aeeb55edaba15a437d85fde7d
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.dev20261116-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
41abc6631251be8a09e6aee2684ebb5106e7f16544459782f2bbc4c100697696
BLAKE2b-256 checksum
How to use checksums
adfa06968d1d187b6c620f4c234e10744c1347d64222096fc7ccd712bd3358f7
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.dev20261116-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261116-cp313-cp313-win_amd64.whl
Size 532.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
34c8e6fa59f39fab854ece9191d4f361f015af39220826d132193594157f6d7b
BLAKE2b-256 checksum
How to use checksums
bc267b9cc4e0341d5598f8458508d463e09e6855f3d6b0c17b01469f6d6088fc
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.dev20261116-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
8b381489feb57595e0f041dab034bc8bff9c0dfa613e7470500ed6959b060dcd
BLAKE2b-256 checksum
How to use checksums
05bf47641083cee35f5dca839209335ffe1e375034c32f687d9d1c6163195c2e
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.dev20261116-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
d17f2b66021f2c13386d15daa2d39f9cb34739f830a1cf507ba9b67bb9bd8c9a
BLAKE2b-256 checksum
How to use checksums
b281d8dd164ce35349eae8b219cb65f6a67c981fccd4dadc5e3bdc4918a144d4
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.dev20261116-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
21d2bbe9888d98d1fffd3f2c481a83480dd1cfc6892d035df2e4d2a062ebb036
BLAKE2b-256 checksum
How to use checksums
bd814a3ad0c5b65884e4d9823579791b7697b0e67835837ab2903f519fbfd3df
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.dev20261116-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261116-cp312-cp312-win_amd64.whl
Size 532.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
01bf1a8a2a89c9812d13e5ee613f201d04a8d7b356dfde43f2c0bc0ae0e4d482
BLAKE2b-256 checksum
How to use checksums
eb1f8da3dab9e01a56586aae9f85f9534129a12c671a63035e9543e1575aff14
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.dev20261116-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
2f281b40396e6f503d9c485a0a259f3cbec2b2636ffe91d4c12891f2b795888d
BLAKE2b-256 checksum
How to use checksums
3fed2e83e0e689eb605e9497ecf1a6b56968a5eb06aea2848cb1bb4f0424ba3a
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.dev20261116-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
700569d526030bd3cb6071a87e24b1c6c47a4130686cddb43d84c66cfe6e4d70
BLAKE2b-256 checksum
How to use checksums
acf625fabfa222d60eea224753551398d257019b931098a3dc9ce3411d20bd94
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.dev20261116-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
af6701b842e30c0350334072b7bdc2b3ec3fba6cfc1b788bc2af665ef5e141ec
BLAKE2b-256 checksum
How to use checksums
bc11b8e46138105a8d2c3bd3c5a6471f3622266bb066f11bdb51fdf3a0ed2d5e
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.dev20261116-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261116-cp311-cp311-win_amd64.whl
Size 532.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
08a358d68cd2899bdbeca2f52810fe99e7abc8f079c9be523537e9721e9a894f
BLAKE2b-256 checksum
How to use checksums
24ad6ed4a62ea4a5181cd3ef27101fb79f0f4338f09fc201f372a625a8db8e47
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.dev20261116-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
1e96d0be0e8e3beb78aa8a743d697f921d94902905219b7584dda84082ecd8b6
BLAKE2b-256 checksum
How to use checksums
b36f922c231943ceecf655b6422028e79a81fb5c193e7ee0498d8ea779e45608
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.dev20261116-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
0ceac33916098af1d692b34451acd3b2d65668ce6e25b333ac5e50f73167f9a9
BLAKE2b-256 checksum
How to use checksums
c994ab6cb208432763f2b3f2dcb1b3e8c3a556abadda24afbc69536793dd6487
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.dev20261116-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261116-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
0a22e2e0120cfd6eeaf278af2bb635898866f08273a9f4ab966c2f8ee1569f4f
BLAKE2b-256 checksum
How to use checksums
964382c1ac65e0725e11e7ee45356a4a095db5bbdeb25e90e89e3598000edb5c
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.dev20261116

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