Turn your training loop into an idle RPG.
Project description
lootqdm
Turn your training loop into an idle RPG.
lootqdm replaces bland training progress bars with an idle RPG experience. XP bars, loot drops, quests, achievements, level-ups, critical batches โ all in your terminal.
โญโ ๐ก๏ธ LOOTQDM โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ mnist_run ยท dark_dungeon โ 00:12:34 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ โ
โ PROGRESS โ STATS โ
โ โ โ
โ Epoch 3/10 โโโโโโโโโโโโ 80% โ โ DMG (loss) 0.0234 โ
โ Batch 128/500 โโโโโโโโโโโ 56% โ ๐ฏ CRIT (acc) 94.2% โ
โ ETA 00:08:22 ยท 1284 it/s โ ๐ง MANA (lr) 1e-4 โ
โ โ ๐ loss โโโ
โโโโโโโ โ
โ ๐ฉธ โโโโโโโโโโโโ 2340/3000 LV 7 โ ๐ฅ GPU 78% ยท 4.2 GB โ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ โ
โ LOOT & EVENTS โ QUESTS โ
โ โ โ
โ โ๏ธ LEGENDARY Cursed Crown! +500 โ ๐ acc โฅ 0.95 โฐโฐโฐโฐโฑ 94% โ
โ ๐ Rare Void Shard +50 XP โ ๐ loss < 0.01 โฐโฐโฑโฑโฑ 42% โ
โ ๐ฅ CRITICAL BATCH! +20 XP โ โ
First epoch โ โ
โ ๐ช Rusty Coin +5 XP โ โ
New best acc โ โ
โ โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Install
pip install lootqdm
Quick Start
Minimal
from lootqdm import GameUI
with GameUI(total_steps=1000) as ui:
for i in range(1000):
loss = 0.9 / (i + 1)
ui.step({"loss": loss, "lr": 1e-3})
Wrap an iterable
from lootqdm import GameUI
with GameUI(total_steps=len(dataloader)) as ui:
for batch in ui.wrap(dataloader):
loss = train_step(batch)
ui.step({"loss": loss.item()})
PyTorch
from lootqdm import GameUI
from lootqdm.integrations.torch import LootqdmCallback
epochs = 10
with GameUI(
total_steps=len(loader) * epochs,
total_epochs=epochs,
theme="neon_cyber",
run_name="mnist",
) as ui:
ui.quest("Low Loss", "loss", 0.1, "<=")
cb = LootqdmCallback(ui)
for epoch in range(epochs):
for batch_x, batch_y in loader:
loss, acc = train_step(batch_x, batch_y)
cb.on_batch_end(loss=loss, acc=acc)
cb.on_epoch_end(val_acc=validate())
Keras
from lootqdm import GameUI
from lootqdm.integrations.keras import LootqdmKerasCallback
with GameUI(
total_steps=steps_per_epoch * epochs,
total_epochs=epochs,
theme="cozy_pastel",
) as ui:
model.fit(x, y, callbacks=[LootqdmKerasCallback(ui)], verbose=0)
Themes
Pick a vibe. Four built-in themes:
| Theme | Mood | Icons |
|---|---|---|
dark_dungeon |
Roguelike, gritty | ๐ฉธ ๐ก๏ธ ๐ช ๐ โ๏ธ |
cozy_pastel |
Cottagecore, soft | ๐ฑ ๐งบ ๐ ๐ซ ๐ง |
neon_cyber |
Synthwave, flashy | โก ๐งฌ ๐ ๐งช ๐ |
retro_crt |
Old terminal, ASCII | +XP LV [C] [R] [L] |
GameUI(total_steps=1000, theme="cozy_pastel")
Quests
Set metric-based goals. Progress bars track them live:
with GameUI(total_steps=1000) as ui:
ui.quest("Low Loss", "loss", 0.05, "<=")
ui.quest("High Accuracy", "acc", 0.95, ">=")
# quests check on epoch_end()
Loot System
Every 50 steps, a loot drop is rolled:
| Rarity | Chance | XP | Example (dark_dungeon) |
|---|---|---|---|
| Common | 70% | +5 | ๐ช Rusty Coin |
| Uncommon | 20% | +15 | ๐ง Iron Buckle |
| Rare | 8% | +50 | ๐ Cursed Relic |
| Epic | 1.9% | +150 | ๐ฎ Bloodstone Amulet |
| Legendary | 0.1% | +500 | โ๏ธ Cursed Crown |
Random Events
- ๐ฅ Critical Batch (3% per step) โ bonus XP burst
- ๐ฆ Lucky Batch (1% per step) โ mystery bonus
Achievements
Unlocked automatically:
- First epoch complete
- New best metric (per metric key)
- NaN survived (with warning)
- Level milestones (5, 10, 25, 50, 100)
Stat Mapping
Metrics are auto-translated to game stats:
| ML Metric | Game Stat | Icon |
|---|---|---|
loss |
DMG | โ |
acc / accuracy |
CRIT | ๐ฏ |
lr |
MANA | ๐ง |
val_loss |
vDMG | ๐ก |
val_acc |
vCRIT | ๐ฏ |
Custom mappings:
from lootqdm import StatMapper
mapper = StatMapper(mappings={
"f1_score": ("F1 PWR", "โ"),
"bleu": ("BLEU", "๐"),
})
API Reference
GameUI
GameUI(
total_steps=1000, # Total training steps
total_epochs=10, # Number of epochs
theme="dark_dungeon", # Theme: dark_dungeon, cozy_pastel, neon_cyber, retro_crt
refresh_rate=10, # Max FPS for terminal refresh
emoji=True, # Enable emoji icons
persist=True, # Save profile to ~/.lootqdm/
run_name="my_run", # Display name for the run
)
| Method | Description |
|---|---|
step(metrics, n=1) |
Advance by n steps with optional metrics dict |
epoch_end(metrics) |
Signal end of epoch; triggers quest checks |
log(message, rarity) |
Add message to the loot feed |
quest(name, metric, target, compare) |
Register a quest goal |
wrap(iterable, metrics_fn) |
Wrap iterable with auto step tracking |
pytorch_step(**metrics) |
Convenience for step(metrics) via kwargs |
Persistence
Profile persists across runs at ~/.lootqdm/profile.json:
- Lifetime XP, total runs, level, achievements, loot log
- Set
persist=Falseto disable
TTY Fallback
When not in a terminal (CI, pipes, LOOTQDM_PLAIN=1), lootqdm automatically falls back to plain logging output. No crashes, no garbled text.
Examples
Run the included examples:
# Simple loop with all 4 themes
python examples/basic_loop.py
# PyTorch (falls back to simulation if torch not installed)
python examples/pytorch_mnist.py
# Keras (falls back to simulation if tensorflow not installed)
python examples/keras_callback.py
Development
git clone https://github.com/lootqdm/lootqdm.git
cd lootqdm
pip install -e ".[dev]"
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lootqdm-0.2.0.tar.gz.
File metadata
- Download URL: lootqdm-0.2.0.tar.gz
- Upload date:
- Size: 61.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff8417bd93ccbc22f22e621434343c57ef440ef46c78616c9deaec8459414062
|
|
| MD5 |
12978f22c5afb31b150ea20d0e17ad91
|
|
| BLAKE2b-256 |
f95cfce12de59d7169be6ea8a5c8ab93f9c2f1f902edf3219b9b30f4d5e51499
|
File details
Details for the file lootqdm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lootqdm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec1f3a948ea03c9609921d2f20f397f513ffbc13a224859ab6356087aa262061
|
|
| MD5 |
ede9e913edcebd223d3f5814b51b78dc
|
|
| BLAKE2b-256 |
aec51f2900729c37402ff3ff1927ef1546f5928d646b87e4b87cbe202101cf4d
|