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

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 no
aarch64 yes yes n/a

Quickstart

Existing users

Grain is used by MaxText, Gemma, kauldron and multiple internal Google projects.

Metadata

Release files for grain-nightly 0.2.11.dev20250630

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.11.dev20250630
File
grain_nightly-0.2.11.dev20250630-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.11.dev20250630-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.11.dev20250630-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.11.dev20250630-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
grain_nightly-0.2.11.dev20250630-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
grain_nightly-0.2.11.dev20250630-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 5.5 MB

Release files / grain_nightly-0.2.11.dev20250630-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.2 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3a9f6c4a6319e5bd67a81477ef2e132b37fe82107ab63d5c70a1a8b6b3d18ea5
BLAKE2b-256 checksum
How to use checksums
8b1b3da5fa1ba01b3faad7385a1cda341588009af3c7bca069711a58c5c82be4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ede1146318ea71f8e166de6eefcb14ddd96432aa3a515cf1901b542f39992a18
BLAKE2b-256 checksum
How to use checksums
e98608e64d47edbeb9c9bf5d135aae1ee71b6d6a717b71e521c88ff3720c3251
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp313-cp313-macosx_11_0_arm64.whl
Size 404.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
264517e2fac5c4e46365988142a4d55bcbca33bbf72094e798313958bfa69516
BLAKE2b-256 checksum
How to use checksums
61a2002f0ffd150627c51cc6a15c64adbfa01fafc93f0590fd8ac9e1d911cffb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.0 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
beeb223f35f27fc749a4005eb6aa31af8f697439a18c2dc4c5308fe882783e46
BLAKE2b-256 checksum
How to use checksums
e7a07db7872a95d0c9dd9dd7da65d2102c496aaa265782b7429ee2ca11ece6ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.0 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1973d6d4c4cd8ad26184e4fb979d4126e2e94c7243bc035bdd6c03bfaeda921d
BLAKE2b-256 checksum
How to use checksums
dca333687fe0e5625b5c926cf9bd94bdbeab5d8b34cd0d1b8de4d8a707809466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp312-cp312-macosx_11_0_arm64.whl
Size 404.4 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f7f64cfc2ff3c7b35737da6e88fd4322ca999caa0c1cd1f2994ee61cdc1ae9ec
BLAKE2b-256 checksum
How to use checksums
c67ce91bb8697a25b79f65561030393bfa1a3ae6e5fd479f0ba63eaee8806d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 486.6 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e719886cb2ccdd2db5ed2d01540662c9f58bf12143ed8ed8512e57e42878fe5c
BLAKE2b-256 checksum
How to use checksums
a29ec5a95c64e3ef86979a46870e8f5e746956d4a8ebc8caa9892e3acc975e46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 485.8 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c2b0ec872b680a15ce87251e318771ad7b275a3686da479cef142e1fae3d8cc6
BLAKE2b-256 checksum
How to use checksums
4974386c141bbd48e0de8eedd91179d78244a1c199092eafb0143a5e885a7fb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp311-cp311-macosx_11_0_arm64.whl
Size 403.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1ddb803f0de618b9b2cec6c19038977290e233988694212f26795fd8ee59ca4e
BLAKE2b-256 checksum
How to use checksums
b73d98aca143916d32c8d71e1ce756c1267cdd939bf5a0d224595086cf7c7a0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 486.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d5d7f60828a0ea6b4a43b6a0800f7d7bbaa5888c3d6e3b20d0ed6b5450f374c0
BLAKE2b-256 checksum
How to use checksums
42feffcafd63b10d73036119a8f1c87460d2e7e74b5095f6786396d79c3b46b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 485.5 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
f9cab4c696a3748a72dc145ac282664b456aa4601d47605462c1278148a6bde3
BLAKE2b-256 checksum
How to use checksums
247b73676fd5dc7e3fef43e23167d941be24c7590beaa091103fc9f175f9b3c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / grain_nightly-0.2.11.dev20250630-cp310-cp310-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.11.dev20250630-cp310-cp310-macosx_11_0_arm64.whl
Size 403.4 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
619a37a06e94b11f12527ae8a6841e5ceacbfd7a331e96626792eb729cd90986
BLAKE2b-256 checksum
How to use checksums
1125de4f50418d017f39237289f3b8eb7dfdc8291abe26c4b34bd955c40099bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

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