Tinker Integration
Use tviz to visualize your Tinker training runs.
Setup
Install both packages:
$
pip install tviz tinker tinker-cookbookWith MultiplexLogger
The cleanest integration is adding TvizLogger to tinker-cookbook's MultiplexLogger:
In [1]:
from tinker_cookbook.utils.ml_log import setup_logging
from tviz import TvizLogger
# Setup logging (WandB, Neptune, etc.)
ml_logger = setup_logging(
log_dir="./logs",
wandb_project="my_project",
config=config
)
# >>> tviz <<<
# Add tviz to the multiplex logger
tviz_logger = TvizLogger(run_name="math_rl_experiment")
ml_logger.loggers.append(tviz_logger)
# >>> tviz <<<
# Metrics are logged automatically via multiplex
ml_logger.log_metrics(metrics, step=i_batch)Logging Rollouts
tviz shines when visualizing rollouts. Use the Tinker adapter:
In [2]:
from tviz import TvizLogger
from tviz.adapters.tinker import from_tinker_batch
logger = TvizLogger(run_name="math_rl")
# In your training loop, after rollouts:
trajectory_groups = env.step(...) # Returns list[TrajectoryGroup]
# >>> tviz <<<
# Convert to tviz format
rollouts = from_tinker_batch(
trajectory_groups,
tokenizer=tokenizer # Optional: decodes tokens to text
)
# Log rollouts
logger.log_rollouts(rollouts, step=i_batch)
# >>> tviz <<<Full example: See the Getting Started guide for a complete RL training loop using raw Tinker API with tviz.
View Dashboard
While training, start the dashboard:
$
cd tviz && bun devOpen http://localhost:3003 to see:
- Real-time reward curves
- Loss and KL divergence plots
- Individual rollout trajectories
- Token-level logprobs (if logged)
Full working example: examples/gsm8k_rl.py — Complete GSM8K RL training with tviz logging.