Extra buffer classes for Stable-Baselines3
Reason this release was yanked:
RLE implementation flawed
Project description
sb3-extra-buffers
Unofficial implementation of extra Stable-Baselines3 buffer classes. Mostly a proof-of-concept in current state.
Compressed Buffers
Reinforcement Learning is quite memory-hungry due to massive buffer sizes, so let's try to tackle it by not storing raw frame buffers in full np.float32 directly and find something smaller instead. For any input data that are sparse and containing large contiguous region of repeating values, lossless compression techniques can be applied to reduce memory footprint.
One such kind of input data is Semantic Segmentation (SS) masks (with one color channel representing class labels as integers) and RGB / Color Palette game frames from retro video games should also benefit from compression.
For
4 vectorized Doom environments each storing 4096 SS masks of 256x144 resolution:
| method | dtype | shape | size |
|---|---|---|---|
Baseline |
np.float32 |
(4096, 4, 1, 144, 256) |
2.3 GB |
Cast to uint8 |
np.uint8 |
(4096, 4, 1, 144, 256) |
576 MB |
RLE-auto-slice |
np.uint8 for elements, lengths and positions |
(4096, 4, 145) x 3 |
306 MB |
RLE-flatten |
np.uint8 for elements, np.uint16 for lengths and positions |
(4096, 4) x 3 |
20.4 MB |
gzip-level-1 |
np.uint8 |
(4096, 4) x 3 |
11.1 MB |
gzip-level-5 |
np.uint8 |
(4096, 4) x 3 |
7.65 MB |
gzip-level-9 |
np.uint8 |
(4096, 4) x 3 |
5.17 MB |
Currently implemented compression methods:
- RLE (Run-Length Encoding)
- gzip
Example Usage:
from sb3_extra_buffers.compressed import CompressedRolloutBuffer
buffer_dtypes = dict(len_type=np.uint16, pos_type=np.uint16, elem_type=np.uint8)
buffer_kwargs = dict(dtypes=buffer_dtypes, normalize_images=normalize_images, compression_method=compression_method, auto_slice=False, compression_kwargs=compression_kwargs)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sb3_extra_buffers-0.1.tar.gz.
File metadata
- Download URL: sb3_extra_buffers-0.1.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d03bd23c421fb1ccddbfc10b6e84c74bfeed757f0c1470901eec093710b81a0f
|
|
| MD5 |
acc238cc5d80031cc7ecd8bba657e286
|
|
| BLAKE2b-256 |
5231d94188afd547c5202dab34e6289706a0f383f8ec1ed8f0e84a687462b5ae
|
File details
Details for the file sb3_extra_buffers-0.1-py3-none-any.whl.
File metadata
- Download URL: sb3_extra_buffers-0.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8fe4089dc373d8eb386e8546fec2234bb8ce4afba4daa9b605e0f75803f0cec
|
|
| MD5 |
51fecf62c7ecfc6e9fd555e4498a716d
|
|
| BLAKE2b-256 |
8be94f46740c00499cf7a14aa113baa4d17d9051558e64bb571cc2d5b0fbffa5
|