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

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

Total release size: 9.8 MB

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

Download URL grain_nightly-0.2.20.dev20261122-cp314-cp314-win_amd64.whl
Size 589.0 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
ca17c4be3f553e9687e7a4d974e97d0c5f2a521909acc33565d01bd407032171
BLAKE2b-256 checksum
How to use checksums
052856731597fffe40ba50b6a74671d823cf89b69a5182ac1db6f5d583aaa1e7
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.dev20261122-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 643.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
ecb7f6564d938b52eb81f5d7aedc07a74dcd1b126576021a8b39813e7e7aede1
BLAKE2b-256 checksum
How to use checksums
fc18455baafca75aa8239a7fb944516a3fca25aa2d849dffc21e1b644db5c3ec
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.dev20261122-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 642.0 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
72fd8f82ee80302a3e6742896a3e09ee9ae668e432e4c04c21f2a0ba4f9696a6
BLAKE2b-256 checksum
How to use checksums
7fa4d7384b7be4f44aa8651f0892e52736b8ac511ee7150ac14b134a3db67ba2
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.dev20261122-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp314-cp314-macosx_11_0_arm64.whl
Size 585.4 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b471104e81d068ed09db12613c6fbf6cf1ab1d32d93e8e73eea839e0f79df84c
BLAKE2b-256 checksum
How to use checksums
89de8263fd4ef7b1b07d461abd27cb2912ef4fd5fc77db43ef5820b2b054e6dc
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.dev20261122-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp313-cp313-win_amd64.whl
Size 582.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
3e38261a40a9fd8194c6d97e5eda78c80f8e873bd59ac985f191c4bba0c9a03f
BLAKE2b-256 checksum
How to use checksums
dca2b04669b1bd8e7401d68b02e788bba19e133598d9e81c5a67b9a7d61273a4
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.dev20261122-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 643.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
e721e80e54eaeeddfb8d98a15c1fbcacb6cca38918b42bb4766cca3b39446163
BLAKE2b-256 checksum
How to use checksums
4f083ed6db5e49cb0c6c3ea48e9c9454910b986926ff7215d30b89a24b6b871f
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.dev20261122-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 642.0 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
0b0b55b10fb4a5fde21e416043a709dbcf6e9845e069b3dddef1e8e3dd78dd29
BLAKE2b-256 checksum
How to use checksums
b31077b77fdfe60af2d2f97c8840703f14ecee6942fb8a4b8d7b3d75324412b6
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.dev20261122-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp313-cp313-macosx_11_0_arm64.whl
Size 585.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2af901b0b2537313b557bd9ff3f0cc5cc739ddd82d0fb650243ce5cfc6fad6d4
BLAKE2b-256 checksum
How to use checksums
0fbf27029ab109cafba991e848273fc34626206b1eb5b034f73506eb3dd55f2e
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.dev20261122-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp312-cp312-win_amd64.whl
Size 582.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2b5fb1a7bd4b0979c6fce5e6e8a4e0f6f3a6bbc2a7e7ecb325ee594b813be2ea
BLAKE2b-256 checksum
How to use checksums
d81e90e96f4cb377bb222fc26255d715a38f41c3476f61b913b4e8fadd971b85
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.dev20261122-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 643.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
c0f3d465759b5ba0e7b16ca8296c2311cf3f4160ca564363c2b92f2c356c4fd5
BLAKE2b-256 checksum
How to use checksums
847bd05adcc8ceb1e19b036b8c3b7f9b613a8ac9f8e78c3553f7a400604669e4
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.dev20261122-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

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

Download URL grain_nightly-0.2.20.dev20261122-cp312-cp312-macosx_11_0_arm64.whl
Size 585.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3d66c74392083b5a72364eeae509549b44fa10b3846b73983117f1ad6daaa0df
BLAKE2b-256 checksum
How to use checksums
46879a8ad26287db0d1ff92166f2e88f5f00b17ded7deb43c21a61d1a7550209
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.dev20261122-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp311-cp311-win_amd64.whl
Size 582.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
bdeb0173c46e8c78ea13d92418730209451b2d4f4f54538a390e416c0acb2dff
BLAKE2b-256 checksum
How to use checksums
00301ee6804e2afad75b48499ce3a20be9566b9f8c96cee146f47176c275e2b2
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.dev20261122-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 644.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
c2f149207b2c8790eabcf10b00bdd3a81fbe11081fd4d27cce6343af250ae949
BLAKE2b-256 checksum
How to use checksums
aad1663117f52c5af1c86c5808001533cadcd1d4cd9254ce906a5ce1e8681a19
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.dev20261122-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 643.5 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
3488241e489de715c05535f3e42cc0e4973c92c99855d7de7ea6ed735d375d7e
BLAKE2b-256 checksum
How to use checksums
a225711d5b5ef29bf58c966a725747896efa2c557d4393223c9b188f6fb6b570
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.dev20261122-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261122-cp311-cp311-macosx_11_0_arm64.whl
Size 587.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0a7dfc4bfa311bf76ae33cbe5cd981496fc753e90f5d699d948a9ef62f42ce5f
BLAKE2b-256 checksum
How to use checksums
25fe06d7cea680b19fa31a69047adfdc46b1c95bd832d72cb0ee23dfb815aeb0
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.dev20261122

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