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

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.13.dev20250915

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.13.dev20250915
File
grain_nightly-0.2.13.dev20250915-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
grain_nightly-0.2.13.dev20250915-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.13.dev20250915-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.13.dev20250915-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
grain_nightly-0.2.13.dev20250915-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
grain_nightly-0.2.13.dev20250915-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.13.dev20250915-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.13.dev20250915-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
grain_nightly-0.2.13.dev20250915-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
grain_nightly-0.2.13.dev20250915-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.13.dev20250915-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.13.dev20250915-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
grain_nightly-0.2.13.dev20250915-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
grain_nightly-0.2.13.dev20250915-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.13.dev20250915-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.13.dev20250915-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 7.4 MB

Release files / grain_nightly-0.2.13.dev20250915-cp313-cp313-win_amd64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp313-cp313-win_amd64.whl
Size 418.6 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
e4c1402c73e6d48e647e43ae47337423271357c2d1c1489112ccc20a6235f70d
BLAKE2b-256 checksum
How to use checksums
abe84de9d098c92e41776c605f92ed631f5097442c95e87bc039f721fd4584d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 500.6 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d850b91370ffa4850a4e430eb1ad9b37dc9600b637638e90e04e54e8b9ab6a39
BLAKE2b-256 checksum
How to use checksums
5dfae4188c3199ba4a5e59d51bd531d5e8685c9ce764d84e24952eb9a073f526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 500.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
8cda834e9a619604de753703db19b57929559db8087adb6da00c9f3448c210a6
BLAKE2b-256 checksum
How to use checksums
b568a6ed7d7ebf4ce22d04bbcf0fdb4a30cc727a74417bb9fff608fb8507b935
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp313-cp313-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp313-cp313-macosx_11_0_arm64.whl
Size 427.1 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9e83b20bc09646ec11fd9e0482ac6a9aa7f628551f2263c901c1e2dc9f775a69
BLAKE2b-256 checksum
How to use checksums
74ddbb78fc54804edbf103d7c49a24e74348d6143f52f3439d77796b55397104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp312-cp312-win_amd64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp312-cp312-win_amd64.whl
Size 418.5 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
63199b89ef04bd0084d4c3c2098453ed06769030ba52b0dfc87947467b6d0e33
BLAKE2b-256 checksum
How to use checksums
483b5c409dc1a9d93b9f23e80ea3b17faef1d875ef77e20826ca6796700d8f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 500.5 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2afee3ab62482138892e43d2ad68fac12deb0026f4b4044faae8b43c51da89eb
BLAKE2b-256 checksum
How to use checksums
8cf95c3c45e9cdf7d36db0c498f6f55d7590517d1370694249ed9b124a09d6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 500.0 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
9b5b90a349cf96a7eca1348e2a84bfc2e23d6fe145c28bf7f090db44c5c333a5
BLAKE2b-256 checksum
How to use checksums
1e00cfcdd0b4fae82c9512a64e946f7fdda0b925db2831a6bed7efba7c0124f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp312-cp312-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp312-cp312-macosx_11_0_arm64.whl
Size 427.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
05d86aaeb1a3d00acc538afeda2a9a9121169a0a8d2238eeab472596735e7dbf
BLAKE2b-256 checksum
How to use checksums
04330d330615b3ac422ddb1f3ed4f06a13cc7432489cf97ccafde17a7543c100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp311-cp311-win_amd64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp311-cp311-win_amd64.whl
Size 418.3 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
79922d1a90dfcfafe1a1d49468eef5f2c7785a11cfda46bc3e81d51a24308920
BLAKE2b-256 checksum
How to use checksums
d6ddd58c00ccfea0e36dee125a67952a153b3f82dc7e5f1530d04f2e0a404c39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 501.6 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1c1c6ff001134a6c755cff23d79bcd44084b493dadaea54073289d169f99c982
BLAKE2b-256 checksum
How to use checksums
745d8bed49d943ec9296b025b7671079ef3e3d09cafc09ae6c55ef2d4b047ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 500.8 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
b05938c87ba2e75bde3ec248ea2307305e3c3b7f6c9cbc85ae1895e00c679a68
BLAKE2b-256 checksum
How to use checksums
e682d402c78b34c38418c0d8c28c2e65108de694c4a7963263ac08def112d0a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp311-cp311-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp311-cp311-macosx_11_0_arm64.whl
Size 429.7 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
07bf375770ad5f759f1f7c87a5e41b1490b5b4b8152cc2c21750a2a340cb4bf4
BLAKE2b-256 checksum
How to use checksums
4241cc48ed89fb784eb66076720c1255fe2ba676a8b707d234e7895cbaad1c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp310-cp310-win_amd64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp310-cp310-win_amd64.whl
Size 416.6 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
6aeeea6a3bb9f60a79940831f971485322c1b1e0da4f79901e5dcd60c763b949
BLAKE2b-256 checksum
How to use checksums
cd2dba4639e0c6c75bcc8287e9239b245c1822b7a3ec0c7c099dd3fa9ad1d56f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 500.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d4ba36230cf708f93015204a4b1c82555f9e358735fcc4308dc81d583c5f85c6
BLAKE2b-256 checksum
How to use checksums
2a124eb49089044e4dfbbe2353dabe55213fb5ae2cbfef7203a830f8ad33f943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 500.0 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
bb50d95d6bfce843262852e5f194470f635e3f80e0e27806b7c59a5fd299a985
BLAKE2b-256 checksum
How to use checksums
e31ec4492d740de51d0372fe30c3ae852c846f714036f852c9ccb3e1c625d4d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / grain_nightly-0.2.13.dev20250915-cp310-cp310-macosx_11_0_arm64.whl

Download URL grain_nightly-0.2.13.dev20250915-cp310-cp310-macosx_11_0_arm64.whl
Size 428.3 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8eb5162020ef8f9639cb0987eeeb3bf98c97385afb538b6240b52a5d208cb755
BLAKE2b-256 checksum
How to use checksums
52e8218264034d189b2e2c2113be865714b5dfcad4220b108230583212f8ab5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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