tviz is a visualization dashboard for the Tinker API
Project description
tviz
tviz is a local dashboard for visualizing RL training runs. Similar to wandb, you add a logger to your training loop. Metrics, rollouts, and trajectories are stored in a local SQLite database and displayed in real-time.
Installation
pip install tviz
Quick Start
from tviz import TvizLogger
logger = TvizLogger(run_name="gsm8k_rl")
logger.log_hparams({"model": "llama-3.2-1b", "lr": 1e-4})
print(f"View at: {logger.get_logger_url()}")
for step in range(100):
# ... training code ...
logger.log_metrics({"reward": 0.5, "loss": 0.1}, step=step)
logger.log_rollouts(rollouts, step=step)
logger.close()
Dashboard
git clone https://github.com/sdan/tviz.git
cd tviz && bun install && bun dev
Open http://localhost:3003 to view training runs.
By default, tviz stores data in ~/.tviz/tviz.db. Override with TVIZ_DB_PATH.
API Reference
TvizLogger
TvizLogger(
db_path: str | None = None, # Path to SQLite db (default: ~/.tviz/tviz.db)
run_name: str | None = None, # Human-readable run name
modality: str = "text" # "text" or "vision"
)
Methods
| Method | Description |
|---|---|
log_hparams(config) |
Log hyperparameters dict |
log_metrics(metrics, step) |
Log scalar metrics for a step |
log_rollouts(rollouts, step) |
Log trajectory rollouts |
get_logger_url() |
Get dashboard URL for this run |
close() |
Mark run complete, close connection |
Rollout Format
logger.log_rollouts([
{
"group_idx": 0,
"prompt_text": "What is 2+2?",
"trajectories": [
{"trajectory_idx": 0, "reward": 1.0, "output_text": "4"},
{"trajectory_idx": 1, "reward": 0.0, "output_text": "5"},
],
}
], step=100)
Tinker Integration
from tviz.adapters.tinker import from_tinker_batch
# After rollouts:
rollouts = from_tinker_batch(trajectory_groups_P, tokenizer=tokenizer)
logger.log_rollouts(rollouts, step=i_batch)
Modalities
- text: LLM RL (math, code, chat)
- vision: VLM tasks with images and maps
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 tviz-0.2.2.tar.gz.
File metadata
- Download URL: tviz-0.2.2.tar.gz
- Upload date:
- Size: 59.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8810d5beeca36c56da283e06e2c46a734ade6154790ae2373f9f5f63de7ba0c9
|
|
| MD5 |
73c93997fbecffb52f99cf272a8c9330
|
|
| BLAKE2b-256 |
a19ee5885124c46dc0abe921c1e048a2cc32017b6307e65c6522a04ad5892a25
|
File details
Details for the file tviz-0.2.2-py3-none-any.whl.
File metadata
- Download URL: tviz-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f8b42a00dee1eaed97084db546e4d4d0fd566aea6aabe8b58fea350f5b105e9
|
|
| MD5 |
c00e95656ed401d2618523c9254e4a57
|
|
| BLAKE2b-256 |
6623b913d4566fff8124661685aa5feb57072fb41b724af582ac4c1cc1e11982
|