Skip to main content

Utilities for Ray RLlib and related workflows. Includes experiment setup, callbacks, and JAX model utilities.

Project description

test workflow badge ReadtheDocs Badge Ruff Ruff

Ray Utilities

Features

Many Features are stand-alone and can be used independently. The main features include:

  • JAX PPO for RLlib: A JAX-based implementation of the Proximal Policy Optimization (PPO) algorithm compatible with RLlib Algorithm.
  • Ray + Optuna Grid Search + Optuna Pruners: Extends ray's OptunaSearch to be compatible with
  • Experiment Framework: A base class for setting up experiments with dynamic parameters and parameter spaces, easily run via CLI and ray.tune.Tuner.
  • Reproducible Environments: Reproducible environments for experiments using ray.tune by using a more sophisticated seeding mechanism.
  • Dynamic Parameter Tuning (WIP): Support for dynamic tuning of parameters during experiments. ray.tune.grid_search and Optuna pruners can work as a Stopper.

Furthermore smaller features:

  • Exact Environment Step Sampling: RLlib sampling is slightly off and contains masked samples. A callback and connector piece correct this.
  • Improved Logger Callbacks: Improved csv, Tensorboard, Wandb, Comet logger callbacks. Cleaner logs and better video handling.
  • PPO Torch Learner with Gradient Accumulation: A PPO learner that supports gradient accumulation, useful for training with large batch sizes.

Installation

Install from PyPI

pip install ray_utilities

Install latest version

Clone the repository and install the package using pip:

git clone https://github.com/Daraan/ray_utilities.git
cd ray_utilities
pip install .

Documentation (Work in Progress)

Hosted on Read the Docs: https://ray-utilities.readthedocs.io/

Run Experiments via CLI

Simple entry point:

# File: run_experiment.py
from ray_utilities import run_tune
from ray_utilities.setup import PPOSetup

if __name__ == "__main__":
    with PPOSetup() as setup:  # Replace with your own setup class
        # The setup takes care of many settings passed in via the CLI
        # but the config (an rllib.AlgorithmConfig) can be adjusted
        # inside the code as well.
        # Changes made in this with block are tracked for checkpoint reloads
        setup.config.training(num_epochs=10)
    results = run_tune(setup)

Run the experiment:

python run_experiment.py -a MLP

[!NOTE]
It is recommended to subclass AlgorithmSetup or ExperimentSetupBase to define your own setup. Extend DefaultArgumentParser to add custom CLI arguments. Above's PPOSetup is a very minimalistic example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ray_utilities-0.4.0.tar.gz (219.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ray_utilities-0.4.0-py3-none-any.whl (272.7 kB view details)

Uploaded Python 3

File details

Details for the file ray_utilities-0.4.0.tar.gz.

File metadata

  • Download URL: ray_utilities-0.4.0.tar.gz
  • Upload date:
  • Size: 219.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ray_utilities-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f3b67c9adbca7dbf6fae0bb57b4fabaafe6062eaec72e2827b0069828925a5e5
MD5 297f069e53a73327e8d07508560e1d47
BLAKE2b-256 93205477a3d14fece1b14fb7a0524c37cbc9ea31e9909907a82710dafaf29099

See more details on using hashes here.

Provenance

The following attestation bundles were made for ray_utilities-0.4.0.tar.gz:

Publisher: publish.yml on Daraan/ray_utilities

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ray_utilities-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: ray_utilities-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 272.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ray_utilities-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94e6a8a304a717f32d0ae73f5118dcf2837911755708ddb454744eed17c10db2
MD5 cf5f0127d3f69e810cd09709ca5a9d58
BLAKE2b-256 92b891cbfb9a50c94b1dbcf53a79768f22ddfcb72ed18a0f2c4ce6d89e3e927e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ray_utilities-0.4.0-py3-none-any.whl:

Publisher: publish.yml on Daraan/ray_utilities

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page