Skip to main content

Turn your training loop into an idle RPG.

Project description

lootqdm

Turn your training loop into an idle RPG.

PyPI Python 3.10+ License: MIT

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=False to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lootqdm-0.1.0.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

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

lootqdm-0.1.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file lootqdm-0.1.0.tar.gz.

File metadata

  • Download URL: lootqdm-0.1.0.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for lootqdm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71f8a184c58a21a11f6d1e2c451ec343f701b6861f8ccffeb95a5b69a28a34c4
MD5 60dab77a1f40a0b1fe9dd6ae438ea812
BLAKE2b-256 f9fd51c1341c780918b0600ff9cf17df0aacfdf883a06d11f43e4b7024654213

See more details on using hashes here.

File details

Details for the file lootqdm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lootqdm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for lootqdm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb46640683af74602bdffb9e4977888cc5dc30b94ce6d5af269532dd2128d58e
MD5 3399f37c7e0a94239872adb86801087c
BLAKE2b-256 02b3057db33605db9f22c234fc79645b30907e3a82e4ef779e4df9a77513769c

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