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

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

Total release size: 9.0 MB

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

Download URL grain_nightly-0.2.20.dev20261115-cp314-cp314-win_amd64.whl
Size 538.8 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
e242143b707bbf89ecc69a029634f3e6f97ab82420f4ca56e54f5d105b50e2c5
BLAKE2b-256 checksum
How to use checksums
910c18d3fb8932fadd56137c2c3ba2c417f3c2d0e4c4a572b27c39ac5f582f7e
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.dev20261115-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.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
b289836c5180f7cbd925681767ca5d00304a3058c975d33cc9ddeb0736db9db4
BLAKE2b-256 checksum
How to use checksums
5c11341531561a0a48a0b5324e67c525e6b81793815a7e3ad3c5ddb962cc559a
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.dev20261115-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

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

Download URL grain_nightly-0.2.20.dev20261115-cp314-cp314-macosx_11_0_arm64.whl
Size 535.5 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0f3f013d1cfd8dde52f3754ddf1e2ddbda3a68698a44fa22f217bce935710e98
BLAKE2b-256 checksum
How to use checksums
515b1d656f410a7f0cb4c33ca47689f9957a700e513344fcf75b750ccf9f7362
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.dev20261115-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp313-cp313-win_amd64.whl
Size 532.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
52966a90785f24eec597509894e4178bd4b4b497bfbf4ddcb9cf8c7f87eab299
BLAKE2b-256 checksum
How to use checksums
a65547e6bee80c97fd8b4ed74073282fc48211f867df15ac792e067c90687b9e
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.dev20261115-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.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
0d06060e2f7977039113a1d0624585ccab6f598d998740be3a27d76249cdf19e
BLAKE2b-256 checksum
How to use checksums
2071720291c8cf0690ec384b80747fea4cc62e5ee2e9ae3220f59fb8406a449c
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.dev20261115-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 591.9 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
60b7c26e1b013d577d838f69e0d9e9d3504734233705effcb223b1ccb5af88b8
BLAKE2b-256 checksum
How to use checksums
19e10b72ad8660e944b89e64fad84f7ff0ef739b4bca671c8c9e445e7f09556e
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.dev20261115-cp313-cp313-macosx_11_0_arm64.whl

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

Download URL grain_nightly-0.2.20.dev20261115-cp312-cp312-win_amd64.whl
Size 532.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
70774a91df5896070ceeb29d7cd2d6d90e2b9ba2f1dae9583293ae2ca9a32505
BLAKE2b-256 checksum
How to use checksums
25d6983a30ab7facb600baf44d5a1a0966751379896bfc54ae238083edd6bb38
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.dev20261115-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 593.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
2616d8f5fc599d35da8b7d05155c974ebf9b8b67f2e49c99d379c2647f7dbbae
BLAKE2b-256 checksum
How to use checksums
25e6b0994cd0a7a743e7291a83dc0afa73f73164b12e76830254364dbca30c43
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.dev20261115-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

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

Download URL grain_nightly-0.2.20.dev20261115-cp312-cp312-macosx_11_0_arm64.whl
Size 535.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1520a11c67f1b7b424e52dddbc0c9bfed9e33167edf8cfe298f7b9b612a44f7f
BLAKE2b-256 checksum
How to use checksums
e4fcfc999d0c2cb2609bdcd969b8b540f893886f9924e9bf140f91145acfc1ba
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.dev20261115-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp311-cp311-win_amd64.whl
Size 532.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
23fc2eff20f1f39255291953bfb0873e9aec9d02b7d221063dca79a35e158a15
BLAKE2b-256 checksum
How to use checksums
02b5287baa8eb164e43c5de9e0de59537526abe011c417a205d6c208fd700d1d
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.dev20261115-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 594.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
966102a96a0250eb4f6b0694c90784c6ac7563e82efb48e1c429519a92bfda18
BLAKE2b-256 checksum
How to use checksums
fe74417a238d2a90a8ff37fc5dba94bee452ffb62aa40e33e8aeb2dee03c0d64
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.dev20261115-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 593.5 kB
Tags CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
076be21aa4457b6061e208442ee8962466a82d61364bf40422fe900aeaa27a0b
BLAKE2b-256 checksum
How to use checksums
c20891c147a58daf023533b5fe789a0816f04cd1d2da46bc279dfd283bec77e4
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.dev20261115-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261115-cp311-cp311-macosx_11_0_arm64.whl
Size 537.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4f9670998a7f8664867cb646f9fd73cbaf65f775724f2f46dd362270790af6a3
BLAKE2b-256 checksum
How to use checksums
31ff3035cbfaaae9e3840f93c943dd9da6769d7ada342a006d2533e926f150ad
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.dev20261115

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