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

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

Total release size: 9.1 MB

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

Download URL grain_nightly-0.2.19.dev20261112-cp314-cp314-win_amd64.whl
Size 545.7 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
64a74b6210d8b6f9c3683fbf320323f01ad14b5a25933e2410dfc39bbb3f9801
BLAKE2b-256 checksum
How to use checksums
1accd1a8b91f1a65a5dc48fdd9d617f5eac4884b165fa305bd234a07d51f85ba
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.dev20261112-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 600.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
450f6dcebd642a34c5d317e1424870d08794773a5c24768b492e91d1455fa2fc
BLAKE2b-256 checksum
How to use checksums
1a8baaf82609a8659fd7e6da26c993ae1346e891fccaa6ef5d5346a56ffd29a9
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.dev20261112-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 599.0 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
a59b4c0462a6821ff77298e3ef730154644491b2c2a8821291dfd5ebcaa36375
BLAKE2b-256 checksum
How to use checksums
496f8c09d8f2e5391bbfd06f343a11fb7ca3ec3a673c5cb52ebea8e6844d2e4b
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.dev20261112-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp314-cp314-macosx_11_0_arm64.whl
Size 542.4 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ad70152b2212367aa405da3aab509cfc3939a366e0d3d2b3e7b63b7ddaec225b
BLAKE2b-256 checksum
How to use checksums
4fb65651b73323403790ff422180739daaf3e68b5132669a544cf26b5cc955cb
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.dev20261112-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp313-cp313-win_amd64.whl
Size 539.4 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
6b8a05164e740d1b06caa142107c53acc82cb1e5324e5919236b837da5e20c92
BLAKE2b-256 checksum
How to use checksums
0065d64311a1986ffc274674d619004f1c6c8efbd4de48fca9795fab68b76b8a
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.dev20261112-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 600.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
078e536cc436a2704c79e05ffd258f3ac9658888984240d8cfd3bb9135135ca3
BLAKE2b-256 checksum
How to use checksums
a1195971483802d8184b6268b546bf83100588228dc2f1b63f5b87c005921204
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.dev20261112-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 599.0 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
d7de28505ce8aec98f32d7493c08833e5a089fdde98ca3730cfc7a02acf2da13
BLAKE2b-256 checksum
How to use checksums
b88f8afcca91eb45a88ecd1c5b0cb8e75263270de6f604441f44e68ca4b5c370
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.dev20261112-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp313-cp313-macosx_11_0_arm64.whl
Size 542.3 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
138e11ac21b3106fc5a6b19b1c26b4f685320db781a7956132beecc48fbd0943
BLAKE2b-256 checksum
How to use checksums
0be3f45bda647725a60b6df3cb909cd6737169d643cdffafa81ed43749eeb99b
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.dev20261112-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp312-cp312-win_amd64.whl
Size 539.3 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e154e63a2703460901e056f36e195ce10841583cccb04f4be54341055fcb61af
BLAKE2b-256 checksum
How to use checksums
cc575918b5de0e13dc0c91368c19c92bfa935c89edde8adf325529423e43a4dd
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.dev20261112-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 600.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
9f0de2b668aed8b967b116e12c4cffa81b662ac09baf26ea0689401702cb9e77
BLAKE2b-256 checksum
How to use checksums
a1252b02902c80b9fa35c5cb5b9491a4a4032ba1502297a352d37ef7b8a4a36a
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.dev20261112-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 598.9 kB
Tags CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
ced6c068aadd71627c8cfd904d7269e54c062ced22ec91e00393b2c2b215d227
BLAKE2b-256 checksum
How to use checksums
97b53b9f4dde9ff14971e21a8e1f14cc4477eecbcecf89e2118f6a1868874790
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.dev20261112-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp312-cp312-macosx_11_0_arm64.whl
Size 542.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0bea93d8cf9b886a53574eb041be5e58b9e138eef309386a6e7d70111d199cdf
BLAKE2b-256 checksum
How to use checksums
a21421edfcaea6caace21e890fe07ba67b740f7dbb1e784fa05e175760f81baa
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.dev20261112-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp311-cp311-win_amd64.whl
Size 539.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
b6da9a06816b1e27bd8d6f288b41609afaac7ee1a042dcc268246c2dc2588975
BLAKE2b-256 checksum
How to use checksums
2e94e4a232fa0d290461a44085f708e9104abf415506884cb70bb2be0c152559
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.dev20261112-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.19.dev20261112-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 601.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
cb6c93260003a1edac24b288ef98d4aa381ae874bc5055ca22ddd0c8df4deb0a
BLAKE2b-256 checksum
How to use checksums
c0d36a150b67e812cbbccaf8156efb05a31b983fbd085edf4f2d54c87dc7fcb2
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.dev20261112-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

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

Download URL grain_nightly-0.2.19.dev20261112-cp311-cp311-macosx_11_0_arm64.whl
Size 544.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
44f527dd13fe063c72bb8ad64d5f529cff60ddc1009479dff6ca5fd7df67b666
BLAKE2b-256 checksum
How to use checksums
5e92b91e7e2ba513daa56719e41ddc983f69486eae10798124dc3edb2fc96411
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.dev20261112

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