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

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

Total release size: 9.8 MB

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

Download URL grain_nightly-0.2.20.dev20261119-cp314-cp314-win_amd64.whl
Size 588.5 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
51acefc8f99df142dec062b66797ae9c5adcbf866374d128313f46034c029945
BLAKE2b-256 checksum
How to use checksums
4b74ffb943005bfa4b28fe325db306f8e1460dad18e11ff75c21c8c38303cf44
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.dev20261119-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

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

Download URL grain_nightly-0.2.20.dev20261119-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
d289e7b7575003fec717083035eb117690daa50de8a2abebb7f6ab46dd2150b2
BLAKE2b-256 checksum
How to use checksums
f7daceeae7900dd3276370915a9d2083c6c89d03091c639eee7f7cc8ea4e5525
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.dev20261119-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp314-cp314-macosx_11_0_arm64.whl
Size 584.9 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7d09c83adb4f48b3c4269fcd397a68f01b20d6d72668c706b2beca01f8dce000
BLAKE2b-256 checksum
How to use checksums
8a0fb3af02b4e25ca82c9ee298389e4eee577595018c15f0cd920ee7e40d136a
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.dev20261119-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp313-cp313-win_amd64.whl
Size 582.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d82af4a169435eaa0fb84c596030d7948f7173196d62a8007ebd3c91a4984879
BLAKE2b-256 checksum
How to use checksums
86ef9164fedd7ea3faeda80e252cac670a98444bdae1bbd925b6ab44525221c9
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.dev20261119-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261119-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
078da4b5d1f0b428e9fdf53be81112526192eb788805382f116655fe8bc54eef
BLAKE2b-256 checksum
How to use checksums
c4549d58914d7c02181d411b98881e8a7a7e49a28b64ee1a75d91a6e99f5fd16
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.dev20261119-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 641.5 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5f8f723c66aaafc5a76e271381d549dbf0f25756e7f077b3d258cf9958aee0b7
BLAKE2b-256 checksum
How to use checksums
ad50cb64bb2478ebbf0ffd5bd4b8e5222152d76c68cc2b9bafcb16f490100b9e
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.dev20261119-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp313-cp313-macosx_11_0_arm64.whl
Size 584.9 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bee9d8b0de7ab81e13bde20c21e4cc959b116b8ea3317caab7bb65787e8375ea
BLAKE2b-256 checksum
How to use checksums
3d2609c6bff136c47ac86137c3ff3bc664a33f96bead6ef4fc99a523ad80fcd6
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.dev20261119-cp312-cp312-win_amd64.whl

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

Download URL grain_nightly-0.2.20.dev20261119-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
05a857915982b0f2c3305a4a4605207995f5a3b703f0ae0befbb5a7fa3333e54
BLAKE2b-256 checksum
How to use checksums
fc04855448d68f73fc65132aeea6688ba0912072fb6f374882b1a0a1fe1a9677
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.dev20261119-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

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

Download URL grain_nightly-0.2.20.dev20261119-cp312-cp312-macosx_11_0_arm64.whl
Size 584.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
21762f32cb6f727052256be1e7b2f853bb08372d2e6019bdd6627e3fe9da752f
BLAKE2b-256 checksum
How to use checksums
9015e8eac3d06e5ddb3ee03e58e27c8e0bd1ae763bb9b2c75b76d2e5a27aa8d9
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.dev20261119-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp311-cp311-win_amd64.whl
Size 582.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
6585dc181b191d842cc4d6bd8d434b17e8aa7f9273fbd1270a6403132e8b6f18
BLAKE2b-256 checksum
How to use checksums
44a4df0951815c13f5b87727c0baac1f476364229f464a232139e235aa2457b8
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.dev20261119-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261119-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
68cbbf6e8383d94fca97aada91a41dc952426382406f7b1e3c5683e4ebae3504
BLAKE2b-256 checksum
How to use checksums
cccf4669dc348265a63e8586d05fc88ada2aec894e68e81b21bc0dc43342729b
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.dev20261119-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 643.0 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4e049d2b42a12e5cff0b29a9108d4c85c12d74fb4862bfbba1144b9276193058
BLAKE2b-256 checksum
How to use checksums
31735bcfbdee3b7347a67e0fdf5735cbdbd8f225d293bd79ede96b156c354abf
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.dev20261119-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261119-cp311-cp311-macosx_11_0_arm64.whl
Size 587.3 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0e0078ffb5a842ee09150b4662ec1c307e924d7f750f9e590e0286293cb03a43
BLAKE2b-256 checksum
How to use checksums
374364b3beef0502f2880c4d1907bc5a5ce8a8df1d32644300e254e5abc66c2c
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.dev20261119

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