Skip to main content

A comprehensive Python package for managing AWS DeepRacer training workflows, model evaluation, and deployment. Features include pipeline management, custom model training, evaluation metrics, and visualization tools.

Project description

drfc_manager


A Pythonic workflow manager and wrapper for DeepRacer for Cloud (DRfC)

DRfC Manager Logo

Stars GitLab Forks Contributors Licence Issues Licence CodeRabbit Pull Request Reviews

Table of Contents

  1. Objective
  2. Key Features
  3. Installation
  4. Usage
  5. Advanced Usage
  6. Troubleshooting
  7. Idea behind
  8. Contributing

Objective

The main purpose of this library is to provide a Pythonic, Jupyter-friendly interface to manage your workflow within the DeepRacer for Cloud (DRfC) environment.

This library allows users to optimize the training, evaluation, and management of Reinforcement Learning (RL) models by orchestrating the entire process from Python scripts or Jupyter Notebooks. It supports local, MinIO, and AWS S3 storage, and is designed for multi-user environments (e.g., JupyterHub).

Key Features

  • Easy model configuration for training (hyperparameters, model metadata, reward function)
  • Pipeline management for training, evaluation, cloning, stopping, and metrics
  • Multi-user support: user-specific temp/log directories, safe for JupyterHub
  • Local, MinIO, and AWS S3 storage support
  • Automatic Docker Compose orchestration for all flows
  • Jupyter Notebook integration: run, monitor, and stop jobs from notebooks
  • Advanced logging: per-user, per-run logs for debugging and reproducibility
  • Extensible: add new pipeline steps or customize existing ones
  • Integrated viewer pipeline: Launches a real-time Streamlit-based viewer and video stream proxy for model evaluation and monitoring.

Installation

pip install drfc_manager
# or clone and install locally
# git clone https://github.com/joaocarvoli/drfc-manager.git
# cd drfc-manager && pip install .

Usage

1. Define configuration model data

from drfc_manager.types.hyperparameters import HyperParameters
from drfc_manager.types.model_metadata import ModelMetadata

model_name = 'rl-deepracer-sagemaker'
hyperparameters = HyperParameters() 
model_metadata = ModelMetadata()

2. Define the reward function

def reward_function(params):
    # Your custom reward logic here
    return float(...)

3. Run a training pipeline

from drfc_manager.pipelines import train_pipeline

train_pipeline(
    model_name=model_name,
    hyperparameters=hyperparameters,
    model_metadata=model_metadata,
    reward_function=reward_function,
    overwrite=True,
    quiet=False
)

4. Evaluate a model

from drfc_manager.pipelines import evaluate_pipeline

result = evaluate_pipeline(
    model_name=model_name,
    run_id=0,
    quiet=True,
    clone=False,
    save_mp4=True
)

5. Clone a model

from drfc_manager.pipelines import clone_pipeline

clone_pipeline(
    model_name=model_name,
    new_model_name='my-cloned-model',
    quiet=True
)

6. Stop a running pipeline

from drfc_manager.pipelines import stop_training_pipeline, stop_evaluation_pipeline

stop_training_pipeline(run_id=0)
stop_evaluation_pipeline(run_id=0)

7. Start/Stop metrics (Grafana/Prometheus)

from drfc_manager.pipelines import start_metrics_pipeline, stop_metrics_pipeline

start_metrics_pipeline(run_id=0)
stop_metrics_pipeline(run_id=0)

8. Start/Stop the viewer

from drfc_manager.pipelines import start_viewer_pipeline, stop_viewer_pipeline

# Start the viewer (for a given run_id)
viewer_result = start_viewer_pipeline(run_id=0, quiet=True)

# Stop the viewer
stop_viewer_pipeline(quiet=True)

Troubleshooting

  • Docker Compose errors: Make sure Docker is running and your user has permission to run Docker commands.
  • Multi-user issues: Each user gets their own temp/log directory. If you see permission errors, check directory ownership and permissions.

Idea behind

This lib is developed using the same ideas and implementation as the aws-deepracer-community/deepracer-for-cloud repo: "A quick and easy way to get up and running with a DeepRacer training environment using a cloud virtual machine or a local computer".

Contributing

We welcome contributions! Please see our CONTRIBUTING.md for guidelines and instructions.


For more examples and advanced configuration, see the examples/ directory.

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

drfc_manager-0.1.4.tar.gz (61.2 kB view details)

Uploaded Source

Built Distribution

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

drfc_manager-0.1.4-py3-none-any.whl (87.0 kB view details)

Uploaded Python 3

File details

Details for the file drfc_manager-0.1.4.tar.gz.

File metadata

  • Download URL: drfc_manager-0.1.4.tar.gz
  • Upload date:
  • Size: 61.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for drfc_manager-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ed53ce493ddc3a35cc6e38ca0b490702bdf26aa6f2b4bd94ab5b39e144539160
MD5 c4fef17a0ff44c1b43837c45853055ae
BLAKE2b-256 37e829f803629215cc7558b277b2d29ba41c28a3b4448e3ec8d2a4497445a062

See more details on using hashes here.

File details

Details for the file drfc_manager-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: drfc_manager-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 87.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for drfc_manager-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e3ad241cfe5d5a4cdbfbaf89e6e5435c9633c24243b444507148f627d25895f8
MD5 d9ec950d091ce0e2886daade0699c567
BLAKE2b-256 0ac01635e53f82aa7b0bd987fc16c30b65aff0c5523adb587726244a346e2859

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