Skip to main content

A powerful Reinforcement Learning toolkit for classic games, featuring the Retro Speedlab Command Center.

Project description

datenwissenschaften: Retro Speedlab 🚀

License: GPL v3 Python 3.12+

datenwissenschaften is a high-performance Reinforcement Learning (RL) toolkit designed to streamline training on classic video games. Built on top of stable-baselines3 and stable-retro, it provides a robust framework for developing, monitoring, and perfecting RL agents.

At its core is the Retro Speedlab Command Center, a beautiful real-time dashboard that keeps you in control of your training sessions.

✨ Key Features

  • 🎮 Retro Speedlab Command Center: A rich, interactive terminal dashboard to monitor steps, win rates, episodes per minute, and uptime in real-time.
  • 🏋️ Effortless Training: Use the Trainer class to orchestrate complex training sessions with minimal boilerplate.
  • 📊 Smart Callbacks: Automatic model checkpointing, best-episode recording (including .bk2 replays), and episode uploading.
  • 🛠️ Robust Infrastructure: Built-in support for environment wrappers, ROM management, and flexible configuration via environment variables.
  • 🚀 Optimized for Stable Retro: Seamless integration with the latest classic gaming environments.

🚀 Quick Start

Installation

pip install datenwissenschaften

Basic Usage

import os
from datenwissenschaften import Trainer, EnvironmentBuilder, ModelBuilder
from stable_baselines3 import PPO

# 1. Configure your environment
os.environ["RETRO_SPEEDLAB_GAME_ID"] = "SonicTheHedgehog-Genesis"
os.environ["RETRO_SPEEDLAB_ROM_PATH"] = "./roms"
os.environ["RETRO_SPEEDLAB_MODEL_DIR"] = "./models"
os.environ["RETRO_SPEEDLAB_RECORDING_DIR"] = "./recordings"
os.environ["RETRO_SPEEDLAB_TIMESTEPS"] = "1000000"

# 2. Build the environment (using a wrapper if needed)
def my_wrapper(env):
    return env

builder = EnvironmentBuilder(wrapper=my_wrapper)
venv = builder.build(n_envs=8)

# 3. Initialize model and trainer
model_builder = ModelBuilder(build_model=lambda env: PPO("CnnPolicy", env))
model = model_builder.build(venv)
trainer = Trainer()

# 4. Start training and watch the Command Center take off!
trainer.train(model)

⚙️ Configuration

The toolkit is highly configurable via environment variables:

Variable Description Default
RETRO_SPEEDLAB_GAME_ID The ID of the game to train on (e.g., SonicTheHedgehog-Genesis). Required
RETRO_SPEEDLAB_ROM_PATH Path to the directory containing your ROMs. Required
RETRO_SPEEDLAB_MODEL_DIR Where to save trained models and checkpoints. Required
RETRO_SPEEDLAB_RECORDING_DIR Where to store episode recordings and .bk2 files. Required
RETRO_SPEEDLAB_TIMESTEPS Total number of timesteps to train for. Required
RETRO_SPEEDLAB_NUM_ENVS Number of parallel environments to run. 1
RETRO_SPEEDLAB_SAVESTATE Specific savestate to start from. None

📜 License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.


Developed with ❤️ by datenwissenschaften.

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

datenwissenschaften-1.0.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

datenwissenschaften-1.0.0-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file datenwissenschaften-1.0.0.tar.gz.

File metadata

  • Download URL: datenwissenschaften-1.0.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.12.3 Linux/6.17.0-23-generic

File hashes

Hashes for datenwissenschaften-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2b554ad31ead35f8b5417a2900b17cc48ba9ff990826a43196318578f95f6f2b
MD5 d89e9652504c630f15161708c037f239
BLAKE2b-256 e8e8d2903116b9f1283c41065c6f696efb60b520cebc925d479f6721da738967

See more details on using hashes here.

File details

Details for the file datenwissenschaften-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: datenwissenschaften-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.12.3 Linux/6.17.0-23-generic

File hashes

Hashes for datenwissenschaften-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e31bb7c178212868a1ae01b2797b9af138d1168d5061dc2ce8c74ae2a092f0a
MD5 41b31a7f9193bfea841f34192c73d120
BLAKE2b-256 10e6c496d23ec45a8145d5f7f5e448ce9457bcdc66732ec3c88eebb922be76e4

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