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.2.tar.gz (99.7 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.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchrl_agents-0.2.2.tar.gz
Algorithm Hash digest
SHA256 69ebf261a3e5d32688ac15e874aae507b46163365bb64d99f7b93a45e028b9db
MD5 cda4b9cf57ed6c68b3c82c4bb69294b7
BLAKE2b-256 ff5f8de68c7ec71d7aa528ad2a4230c41ce78ae1b5ac856102831d51f26de108

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torchrl_agents-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d75be85a5519cd7487f1464979ddd31dc88903802435433791a4069b040ee9d8
MD5 bf0f0e9607fcf4a1f347814cab6cc422
BLAKE2b-256 eb8d4a560084d3c14dbf14b20f7363f4f336bfbb0b41f28c62427f155dd3b9e6

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