Skip to main content

Object-oriented RL agents based on torchrl, together with examples on benchmark environments.

Project description

TorchRL Agents

TorchRL Agents is a Python package that provides object-oriented reinforcement learning (RL) agents built on top of PyTorch and TorchRL.

Object-Oriented Design

At the core of this package is the Agent abstract base class, which defines a structured interface for RL agents. The Agent class provides a blueprint that other classes can subclass to implement specific RL algorithms. This design ensures consistency and reusability across different agents.

Key Features of the Agent Class:

  • Abstract Methods: Enforces the implementation of essential functionalities, such as processing batches and defining policies.
  • Serialization: Supports saving and loading agent configurations and weights, enabling easy training and deployment.
  • Modularity: Allows for easy extension and customization by subclassing.

By subclassing the Agent class, you can implement various RL algorithms while adhering to a consistent structure.

Examples

The examples folder contains practical demonstrations of how to use the agents implemented in this package. These examples showcase:

  • Training RL agents on benchmark environments such as CartPole and Pendulum.
  • Using the modular components of the Agent class to customize behavior.
  • Saving and loading trained agents for evaluation or deployment.

Getting Started

  1. Install uv

  2. Clone the repository and create a virtual environment:

    git clone https://github.com/valterschutz/torchrl-examples.git
    uv sync
    
  3. Explore the examples folder to see how to train and evaluate RL agents. The scripts can be run without any arguments.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

torchrl_agents-0.2.1.tar.gz (99.8 kB view details)

Uploaded Source

Built Distribution

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

torchrl_agents-0.2.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file torchrl_agents-0.2.1.tar.gz.

File metadata

  • Download URL: torchrl_agents-0.2.1.tar.gz
  • Upload date:
  • Size: 99.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for torchrl_agents-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7c69043d9a6752db07c8d787e1ddd4afa2793987809547539e378c929d7479b4
MD5 69c47d17f6eaa81cdf989bbfb8f82dcb
BLAKE2b-256 26332605b1a0687d5519cb12a5f249c93f7eb9a335c255f5bcebb98fce2c652d

See more details on using hashes here.

File details

Details for the file torchrl_agents-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for torchrl_agents-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86a5f1ac9fc99c3760f498fe33990bac1dce91a012382ab09f929d47339fb591
MD5 5d3d66467bbd75e401016d5c3b1ece97
BLAKE2b-256 74577a0f1cdf9af62c700ca2830a18bd9adf4e91d9ad354f4e4108b1f3612c03

See more details on using hashes here.

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