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.3.1.tar.gz (204.1 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.3.1-py3-none-any.whl (255.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ray_utilities-0.3.1.tar.gz
  • Upload date:
  • Size: 204.1 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.3.1.tar.gz
Algorithm Hash digest
SHA256 10aad7aa30af22e9dd07c4c79a1eaea26ab04dbc6e3e8a27a04d47935fa0436e
MD5 f6f38a947ab051806acc635ea08d1aa5
BLAKE2b-256 41d89a8f7cd483dd255186de2e33006b069ddb808746f71a886a76ed8f401ee5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ray_utilities-0.3.1.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.3.1-py3-none-any.whl.

File metadata

  • Download URL: ray_utilities-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 255.3 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 333e9375ea8e389551d81016c9bd6899c318bb12575139fc05496a2d419014f3
MD5 c09a10acc0ff88b7c2ef300f66929764
BLAKE2b-256 03e1017f5273a9dc7d504ce02da1f0f245e28a90bddbb617499bd3199ed976c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ray_utilities-0.3.1-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