Skip to main content

tinygym

tinygym reimplements flashrl while using tinygrad instead of torch

🛠️ pip install tinygym or clone the repo & pip install -r requirements.txt

  • If cloned (or if envs changed), compile: python setup.py build_ext --inplace

The README of flashrl is mostly valid for tinygym with the biggest difference being:

  • tinygym is not fast (yet) -> Learns Pong in ~5 minutes instead of 5 seconds (on a RTX 3090)

Just like in flashrl, python train.py should look like this (with the progress bar moving ~60x slower):

Check out the onefile branch, if you want to make it fast(=try to make TinyJit work)!

Implementation differences to flashrl

The most important difference (enabled RL after 2 hours of debugging):

  • Use .abs().clip(min_=1e-8) in ppo to avoid close to zero values in (value - ret)

Without this the optimizer step can result in NaNs and "RL doesn't work" 😜

To potentially enable tinygrad.TinyJit (does not work yet, hence the slowness)

  • Learner does not .setup_data and
  • rollout is a function (instead of a Learner-method) that fills a list with Tensors and .stacks them at the end

Since it somehow performs better

  • .uniform (tinygrad default) instead of .kaiming_uniform (torch default) weight initialization for nn.Linear

Custom tinygrad-rewrites of torch.nn.init.orthogonal_ & torch.nn.utils.clip_grad_norm_are used

You'll find a .detach() here and a .contiguous() but other than that tinygym=flashrl 🤝

Acknowledgements 🙌

I want to thank

and last but not least...

Release files for tinygym 0.1.0

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 tinygym 0.1.0
File
tinygym-0.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
tinygym-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
tinygym-0.1.0-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details
tinygym-0.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
tinygym-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
tinygym-0.1.0-cp312-cp312-macosx_10_13_universal2.whl CPython 3.12 CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) Details
tinygym-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
tinygym-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
tinygym-0.1.0-cp311-cp311-macosx_10_9_universal2.whl CPython 3.11 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) Details
tinygym-0.1.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
tinygym-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
tinygym-0.1.0-cp310-cp310-macosx_10_9_universal2.whl CPython 3.10 CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) Details

Total release size: 13.2 MB

Release files / tinygym-0.1.0-cp313-cp313-win_amd64.whl

Download URL tinygym-0.1.0-cp313-cp313-win_amd64.whl
Size 693.8 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d34c486ea82dcae6dbecd81fd8e387ccf6d36ddcd381989c8df60e9d11b8677d
BLAKE2b-256 checksum
How to use checksums
dedaae10c098b50711e009828560d5c029b1a7d3455b0fea18e21e575d6e2441
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tinygym-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.7 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9714d9a6558ace1dc35cd81c427a79b8f0f0994a4cf77a505862c56a47f371a0
BLAKE2b-256 checksum
How to use checksums
3b21f9c13e59a070aacb1c741290cd07da46566d68a3891212baf13ac085555e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp313-cp313-macosx_10_13_universal2.whl

Download URL tinygym-0.1.0-cp313-cp313-macosx_10_13_universal2.whl
Size 960.5 kB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
c46dbcc54d228b214ecc5c6dbaabba9274575a01f05f60d3f2d3ff50f56b1b79
BLAKE2b-256 checksum
How to use checksums
62c158bb13cb9dd371aace31f1687064df3fe6bbd68cd828d43fd10427c54395
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp312-cp312-win_amd64.whl

Download URL tinygym-0.1.0-cp312-cp312-win_amd64.whl
Size 693.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
39786adddb1c77159bf1d23b2dc94d4f9ab96766d9a703f54b973fe39b2e3e8f
BLAKE2b-256 checksum
How to use checksums
3f1b6319ddf86b29fa06deb9265da7d23b877e7427b903d5e2b57046ce4edb96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tinygym-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5b88d84f338d09a0b83d54ddd4319523da7e2bd2d9a48017b4a94d8d09d31de8
BLAKE2b-256 checksum
How to use checksums
942163f44a25c0ea23dcac45c7c98dc28d4244ea609d5347b97d30bd0ad636b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp312-cp312-macosx_10_13_universal2.whl

Download URL tinygym-0.1.0-cp312-cp312-macosx_10_13_universal2.whl
Size 964.8 kB
Tags CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
729b4cdb38596577e323c8ff9030c4a17cf6a0b1fe69adf7cbf544dc31f56fc5
BLAKE2b-256 checksum
How to use checksums
2b2e6b82909ff66e7107cddf1153ac181c9dccb8f1cfc0577e4910dcdd8116e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp311-cp311-win_amd64.whl

Download URL tinygym-0.1.0-cp311-cp311-win_amd64.whl
Size 688.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e1bc16635b24db5634e4a978e28671eed1c0d031c85a4cf05172f5446221d069
BLAKE2b-256 checksum
How to use checksums
c2832bedd199674ad96b21bf4e212a7ba8f3444f95296906676dbc14e81e7b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tinygym-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8890938d64b3770b62f065231ff48ddd5b2a3f84ab2b68911404043c90dbb3b0
BLAKE2b-256 checksum
How to use checksums
7e2d2ae9a0c1b9585f4f4f346ba82a554eaeb8693c7f8e20b780be338df5556f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp311-cp311-macosx_10_9_universal2.whl

Download URL tinygym-0.1.0-cp311-cp311-macosx_10_9_universal2.whl
Size 959.6 kB
Tags CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
138e23b33c030409b6c23585801e4dd4b7b1b015835e89f2b0d4c22170f08d0a
BLAKE2b-256 checksum
How to use checksums
2f128b7824501f73764c8cef9059f3a3ba3cf83d32fe2168717091da6f1d77e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp310-cp310-win_amd64.whl

Download URL tinygym-0.1.0-cp310-cp310-win_amd64.whl
Size 688.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
da5f0c264cc58c760df94433a75d9143cf46a8d1927534cf09e5aeb03a0807fe
BLAKE2b-256 checksum
How to use checksums
67adfc91f751a40a6115fc55fe450a5f7f1a6410c72699cb7fab0c510e2053c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tinygym-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c9af217dc8f357f82163fb577084f5e31ee375febf1b655b6a305029edc6e606
BLAKE2b-256 checksum
How to use checksums
26780eb2d79993eb3415131a333336f6a75517a3b0529049e41b50f12c0f85e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / tinygym-0.1.0-cp310-cp310-macosx_10_9_universal2.whl

Download URL tinygym-0.1.0-cp310-cp310-macosx_10_9_universal2.whl
Size 959.0 kB
Tags CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
7a58b2befa521293828f96f4baa886de0cf378567cd379e1081c6ea07feb0f6d
BLAKE2b-256 checksum
How to use checksums
1f3dc28add197dfe9838411ff515bc152674bf97b992fda663afe646da0341ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

12 release files

0.0.1

2 release files

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