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 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.12.dev20250707

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.12.dev20250707
File
grain_nightly-0.2.12.dev20250707-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.12.dev20250707-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.12.dev20250707-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
grain_nightly-0.2.12.dev20250707-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.12.dev20250707-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.12.dev20250707-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
grain_nightly-0.2.12.dev20250707-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.12.dev20250707-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.12.dev20250707-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
grain_nightly-0.2.12.dev20250707-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.12.dev20250707-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.12.dev20250707-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.12.dev20250707-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.5 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c3041a44ae2c6bb7deec9177f295cfcb100bf64e811ba80a560993d8abe8e11c
BLAKE2b-256 checksum
How to use checksums
4abcaba791a7b47fd4ffa5b157b45cb36b00215abcd97b97a4c89a5d98b5ab62
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.12.dev20250707-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.4 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
7b3ab4e6fc7422b5f71c88833eeff77bf457814185f1784968e7996a6b00b8b9
BLAKE2b-256 checksum
How to use checksums
813cc14c61c434c422842e784594a32730cbd4b0871ed5925198d034c64a5663
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.12.dev20250707-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp313-cp313-macosx_11_0_arm64.whl
Size 404.8 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d7b5fdc6b552532c1b21ed1aa1e1ea626f440f0271b58f473302f26c85f24864
BLAKE2b-256 checksum
How to use checksums
ddde2ba606ceac733be6d0c98693b9cf867d6f21b18e2e97de2eeaac248c31cb
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.12.dev20250707-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 488.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7c9877d6227a412b38be35cdcfb5e9139e3d0714407da913d3f9a190d5513787
BLAKE2b-256 checksum
How to use checksums
5fa5f6c298b0cced216f21daa0e52a0e385fbfd9ecfd1298b574806a80d52711
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.12.dev20250707-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 487.3 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ee98e7c7634a3abefbe37779d2f958437d793d5b106e82e1843d81504d361ae5
BLAKE2b-256 checksum
How to use checksums
e3db1b457006fd8f5961d96096ccd126059a561be782bdd3ef1d9bfebbbe7b63
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.12.dev20250707-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp312-cp312-macosx_11_0_arm64.whl
Size 404.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
693660c6e737780979e97752841e30ff1a0532d9c439542db10ef75f8ac266b8
BLAKE2b-256 checksum
How to use checksums
eb9f0f907e1d2c1839b8ecb7afb711eb9d762286955f60499afe6070bd959c3b
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.12.dev20250707-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 487.0 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3f6e5c78b25ff00d405577e59101ebbea23ed5c7b00bc6b0cce7e59e6303d225
BLAKE2b-256 checksum
How to use checksums
8b968355a6db34cb90b74b460f56d6ef42915256729809da5f441818eb2a42a6
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.12.dev20250707-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 486.1 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
bfb5abe5c0193648091c8c91dfa83bd272f8e0967f8a3b15d47fe4c5fada0e88
BLAKE2b-256 checksum
How to use checksums
10177ae6c7683f7bdc37b88477f7a7ef5c746f62037ee45db657e8be90e8869a
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.12.dev20250707-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp311-cp311-macosx_11_0_arm64.whl
Size 403.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8fea8968f42152c03546ca67d2c31b879df864173378dc4299bcf178f78d06a0
BLAKE2b-256 checksum
How to use checksums
c0db758ebd87528f972053e8831f0dacbc31d82edf0c9f3ab88f33aa77c82017
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.12.dev20250707-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 486.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7ca397f5a62d6d885d3210962d770a8de65a7caa025060f70c460718a051c289
BLAKE2b-256 checksum
How to use checksums
ab665e6d896234b380f41d1d44ea173a49e718b3c27cc028f1f83207697afedc
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.12.dev20250707-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 485.8 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
46e5bc233a652b191489887627476cc28752a7195e02f15bc667000dfe4cf7ba
BLAKE2b-256 checksum
How to use checksums
ccc97a6422a294dae1673c2acb82427235b2f8c3e1bf7f4beb85da5bca393228
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.12.dev20250707-cp310-cp310-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.12.dev20250707-cp310-cp310-macosx_11_0_arm64.whl
Size 403.7 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4a7b48364ce5d312c407be4bc37b33fb839480c6a4d703a6a6b6ff4828cb2c0e
BLAKE2b-256 checksum
How to use checksums
1f479605185a4b9314b931a59957b1ddf8358da1c1812115e7c0dd61e2c6318c
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