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

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

Total release size: 9.0 MB

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

Download URL grain_nightly-0.2.20.dev20261114-cp314-cp314-win_amd64.whl
Size 538.8 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
bdccbcdc308ab044ea4803edf93e1a239f1708873ca9f327019b3ca4512a19e1
BLAKE2b-256 checksum
How to use checksums
8378190055c2282c123f1a8f29a5c5a9d512cc24bfacbb06bf3dd96580495076
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.dev20261114-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
e9b49e674e5eb03ad903cab7c7b5cb6c52097a1f3d09f7d7cdc5186d2d7a0c7c
BLAKE2b-256 checksum
How to use checksums
a5e919ba75c6572603d4f0e44a16182cd1838c062c37e75358befe4c824197af
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.dev20261114-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
93b2f9b8a6fdebfcab10083e78e133eede6f88ffb7f7acf6803b27bc3ebab84d
BLAKE2b-256 checksum
How to use checksums
6e7f0b8ff9c3ebe389059034c275fb3fa35fa5091cc3fe73b5e17d7b1fc22ef3
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.dev20261114-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
1dced92cbfd4f416ab60bebbdc8e8fa5445c5e61475aca63d784c052e652f783
BLAKE2b-256 checksum
How to use checksums
aac174193d9436205b57a9448b4bb451a053f1f2e0575a8b0ba107c77b6324aa
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.dev20261114-cp313-cp313-win_amd64.whl

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

Download URL grain_nightly-0.2.20.dev20261114-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
6bcd1bd0b3de3f78c859345d6a51f6fef7cf81fa30c2994ed5fac8949d9907ea
BLAKE2b-256 checksum
How to use checksums
d264c1d3bbd181d82cc08864c6a128d22f5a5ebc2f9e8a0500fbddd32802deb9
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.dev20261114-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
f3b7a5d9024bc6c2a1924935e44754e25732a57ef6a1b5ecacd226eed47d3d50
BLAKE2b-256 checksum
How to use checksums
8fd1469bc0ca94b300ffa383ba4f14e39e354381bec4d855c38fb8c08d090424
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.dev20261114-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
b1f751a65dc35c0b601b5d587ef90946fd0e92c4b2d51378c6d458ff61606530
BLAKE2b-256 checksum
How to use checksums
ee2955bb1144d11af29426278f88e422cd81d9980b6ec45273e1401fcfb8c658
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.dev20261114-cp312-cp312-win_amd64.whl

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

Download URL grain_nightly-0.2.20.dev20261114-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
cac682f3eefb6a4e8caaed0c093a466220b0b6e888287f72e701c4ce9d48fad2
BLAKE2b-256 checksum
How to use checksums
458fbbd685101102b956420f3a244bb7d2c75c332b0c2942cd3a0ba4388e91d1
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.dev20261114-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
59459d70ba4ffe8305aed65046d00633208a320f80d9282deb5ad3bfaa9a1a6b
BLAKE2b-256 checksum
How to use checksums
3d2f31ab94e82e9a5d41c466bb65b21a7dd494bd69f54dc5959a45de46abb8ce
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.dev20261114-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
7a244fe37421e0a9fd014f4c5ae216df2dab4fbd85906cc0f295bad22ae4480d
BLAKE2b-256 checksum
How to use checksums
052ea822c4d17c98776fd4c37101742d17de059e45d4aeece847ca540a3426c2
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.dev20261114-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261114-cp311-cp311-win_amd64.whl
Size 532.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
3f77dd4acc72c310b844d8806b2456800d812f387cbe786a23e0b4842e040130
BLAKE2b-256 checksum
How to use checksums
27446bba0cb4a89e43230b0b36c0793f57f3f76dec8cd32114928011c0254714
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.dev20261114-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
091700a77b65989c0b97bbc0cb6aa397862cbdf5d9b79701fcd634856bdcc33c
BLAKE2b-256 checksum
How to use checksums
a9831142bbe78b2a77d622f9ceac7593d7e7b94ba6be747f873238a9bc1eb41e
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.dev20261114-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
0831cf7be35ebbe7edae7b1f531d2cb2226bd133d2bbaf9c1617bc0f9604e1b5
BLAKE2b-256 checksum
How to use checksums
1f0ba777f55069dd46a561bbbae730c2c7057e1266beff28b67b4164eee4e0ab
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.dev20261114-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261114-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
0ebf2aa16c9e5fc39bb5b6a992e0dd23ee4edeac94d616744e81e027baf71e07
BLAKE2b-256 checksum
How to use checksums
3d45805fd497dcb08765d30e79537b4d749fa80892e5f47b466944bf027223ad
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.dev20261114

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