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

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

Total release size: 9.8 MB

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

Download URL grain_nightly-0.2.20.dev20261118-cp314-cp314-win_amd64.whl
Size 588.4 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
29132a58e3bee5ad8630d373b931cdd7d1d008cafaa0a1e760f707d6226b1c39
BLAKE2b-256 checksum
How to use checksums
9d50cb5425376c531d5397ee880dcaf65cc8a5b6610e44d37005468473195aa4
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.dev20261118-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 642.7 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8d0a572722c0611310f868226ad5a117a3866ecf70d3d198ba68464cf6b33a3e
BLAKE2b-256 checksum
How to use checksums
b249f0a00c1b0f5a76361a90cfbbf097f89427962db35a742bae4a22badbf449
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.dev20261118-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 641.5 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5764605d0bf2c667a48c393254c2ac3060b168c6a61f7d0b99b01e3f3c94155e
BLAKE2b-256 checksum
How to use checksums
61df740b152a65cec6bbe64ad8fb42249e3b60e7f4459f80460a0a47fd1b833e
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.dev20261118-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp314-cp314-macosx_11_0_arm64.whl
Size 584.8 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fb4c6680be76632c0ac24a02eeaae25c4c03e5dabb78c912991963706cff043a
BLAKE2b-256 checksum
How to use checksums
f2f7fb895f4ff67a90e17a0b722cc1704b37dabd4313aa05554371fa55f040e7
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.dev20261118-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp313-cp313-win_amd64.whl
Size 582.2 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0ce95a101699e6947ee773ed02e91ab438f59a113626e70a7f101d47ed53d882
BLAKE2b-256 checksum
How to use checksums
de9d6e6c8a147ee6fc7c4bb0dbf8fa5d459ac0db9353342ab5d45427c9d25cee
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.dev20261118-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 642.6 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e947d138bbea7e63404a0dc071872d96a148afb4f1a920a4a9cbf02ebf1410be
BLAKE2b-256 checksum
How to use checksums
865895e25cf60a7d1790da1c87a0abdc5a05f03da9b58b596fc8c47932f2a1f2
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.dev20261118-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 641.4 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4222b87bf9fbb79769634fcd6091abb1b8c8c970f4e24ccf312c960c4df045f8
BLAKE2b-256 checksum
How to use checksums
e68fc750357f2c615f47afa692dfeccc997e67c46ebbe7f3f3fe58968e9983e5
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.dev20261118-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp313-cp313-macosx_11_0_arm64.whl
Size 584.8 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
866285bcbe38a1c3bef7e74b063aa1e54ef4d595d3c1fee30f1abd182155b57a
BLAKE2b-256 checksum
How to use checksums
b359070acc87ca7222c9761d487853e36e11c90e8cc984f7db6afc90fb049494
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.dev20261118-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp312-cp312-win_amd64.whl
Size 582.1 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
c076cedce3350c044517597320968a9e83ac65da1169fa661ff75e105806e06c
BLAKE2b-256 checksum
How to use checksums
ad0e86f60d80a1e839f0605832c327a0a33266ddb361fd1a69aa73c5e3fef02c
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.dev20261118-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 642.5 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a8820f107c24f32d4334efd23907d4c2d22521c1e8408b5c90155dc8e53950a9
BLAKE2b-256 checksum
How to use checksums
9f0db4aef70d834a1fd862f8597a71b7cf590729cc021c75e4987ec6e61bdfc0
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.dev20261118-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 641.3 kB
Tags CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
eee3edd75d4777632f7e1394ba7defff09e7e3c7dde19907672825f78c973668
BLAKE2b-256 checksum
How to use checksums
b0adbb1a55bf43304a0c75372e20a0529e00389dea38222c64a758e319466b2f
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.dev20261118-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp312-cp312-macosx_11_0_arm64.whl
Size 584.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
67e1511f4f60700f15e09a33c44b85f9b2be202704d2bc9f669ab09b9ab678cf
BLAKE2b-256 checksum
How to use checksums
efde13f0b1396c9e830a511bd66cb197009615ba7fc93f2b372e3c5c1b9e5e0e
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.dev20261118-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp311-cp311-win_amd64.whl
Size 582.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
3d7aa4cae3cf10a7ead2deb373bf78042c79cca41f79f1403053f5311d37a33b
BLAKE2b-256 checksum
How to use checksums
0cb42efb3421c5db1a932c3471c6ea4eca9ed845e4a01697f82ea8eef4dec8b4
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.dev20261118-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 644.4 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ea5efd98242ca16902ffda4a997c250b6ea8274d6876b2df8452d3f5fb7d5a75
BLAKE2b-256 checksum
How to use checksums
1a7b06a5ba221eba9639828b6f5e61ebdba52136c3d5cb6a507324ec66f91548
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.dev20261118-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 642.9 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
41614ea7521403e5c041bdb9748c16d20568869ff9736748ebe8f763d49a1c51
BLAKE2b-256 checksum
How to use checksums
ad332ac21bdad48a06b3afbdfef16c01a7c5e551b63af8342fb6fbd1905e70e1
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.dev20261118-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261118-cp311-cp311-macosx_11_0_arm64.whl
Size 587.2 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3946cf75cb0bc0a39230f33f7449515a91b14037f5fc56d829d80992f95d13ad
BLAKE2b-256 checksum
How to use checksums
b94c3f8f32b7c2577a254d080ac66c7a6a4b9980cabfd8606885a2f2e15e3ae2
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.dev20261118

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