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

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

Total release size: 9.8 MB

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

Download URL grain_nightly-0.2.20.dev20261123-cp314-cp314-win_amd64.whl
Size 589.0 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
229d582d9d5a5a8cdeb8dd962380c666d8d8cb9be0cb83ed6401a4a67d6b6578
BLAKE2b-256 checksum
How to use checksums
93aa09d1925e0a929c92ba2f9bba1c4f8e9f8d3e0e9c6169ae2e629671e98646
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.dev20261123-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
14b981ecee60d08e063cfd4726f93f16b5f2fe7d48fbc37cb77bc27c5e6b6615
BLAKE2b-256 checksum
How to use checksums
4b181a110a83f3e1da5d45b05e704dcdbae77498497cb3609d85ceca49fc9dcb
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.dev20261123-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
a08fd16d3a5d0b879ed60033b14dd5464af0827b9097419ab1fd3fff93284419
BLAKE2b-256 checksum
How to use checksums
e784a1b9691f8c23bf34c0125ee2d4fbb7d129fffbf483648215f0e9ecff6099
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.dev20261123-cp314-cp314-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
00187d2a7524f55901d31fc66bc9fef04053bae9231fef023d2862f933e1f403
BLAKE2b-256 checksum
How to use checksums
51e4806580155a6229878e2b708faa276df2bc20283621217b9558ad96df219b
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.dev20261123-cp313-cp313-win_amd64.whl

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

Download URL grain_nightly-0.2.20.dev20261123-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
4abe13525c5c69fa1aeb055f76e75beb1f01e8476832f5e84766b99969039d20
BLAKE2b-256 checksum
How to use checksums
0a3b4818e4cba8faf046ae291f3f08264fc855bf19f0aac376b02a825401ada6
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.dev20261123-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
94b57468bd299b59472af9a9f92b0f9a938faccfaabda447c5ca08f2f07ebf85
BLAKE2b-256 checksum
How to use checksums
a7996cb9232a2d4f76d6008c25759bdabf0b25717c3e163c08e504a5c6da0b77
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.dev20261123-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
020624c1c2ffb5ee70363ebbd08459454c172fe70d2411ca48bafb986ad4b52f
BLAKE2b-256 checksum
How to use checksums
673ee66561a41fab60e0753634d66149f94f6b8d4e0760af9de1a0b894a55071
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.dev20261123-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.20.dev20261123-cp312-cp312-win_amd64.whl
Size 582.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
46d4be122d03518c2cbc545fd795f8619a4ecc8f601f26bc332c5c39a4dd77fb
BLAKE2b-256 checksum
How to use checksums
9227d90b7f9f877f269a81613af8b94efec4979b19fcc274f438f155a3a68b5c
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.dev20261123-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
6167f1cbe32e8ca234ac64fb28efec8f6042a330c397a1248bd6e04ac110640f
BLAKE2b-256 checksum
How to use checksums
5440b909005e97ce741c91d187b18a4fdba127d99ce68f1637938ebf08d8b5ed
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.dev20261123-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
0d82e5481cf8af2e52b7e464a529f191aafa29e84ededc5d501a23be7e0a3c6e
BLAKE2b-256 checksum
How to use checksums
1cad28bcb528ee1421046555d53c689854a582e5aa8236dbb605843c09383eda
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.dev20261123-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
df8afa0cebc46508d26d0533442f87ed5a36074a2733b649785b8e5e12de7f6a
BLAKE2b-256 checksum
How to use checksums
5989704df5071d76bc77fdf20b9710167e20d044efdfce6ca122684489db6332
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.dev20261123-cp311-cp311-win_amd64.whl

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

Download URL grain_nightly-0.2.20.dev20261123-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
5769e277e3be1cafc5d1a55260fe0277642f26dcde343597ac8bb9e96e215eb4
BLAKE2b-256 checksum
How to use checksums
87fdb0e7046f798e8dbc3890872fa54e9dcba0a918ef242e8991c156b1ecb843
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.dev20261123-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
939069709eaa180791b5efd48b477435743f4968293418efc8740d242501aefa
BLAKE2b-256 checksum
How to use checksums
a9d1750c4f4b180f918de44f1bff76a1158018b5c9dfd38a891a6d7479f1e34a
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.dev20261123-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.20.dev20261123-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
32e250d4f893e9b7f7688c89d54f35ca5f3ae995c451012c5da6638415b4f581
BLAKE2b-256 checksum
How to use checksums
5330f7987709e169ee8d539049f9525d8a058585fff2c78219e281ee0bdbd3ea
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.dev20261123

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