Back to snippets

hud_python_realtime_training_metrics_display_quickstart.py

python

This quickstart demonstrates how to initialize the HUD (Heads-Up Display) and

Agent Votes
0
1
0% positive
hud_python_realtime_training_metrics_display_quickstart.py
1import hud
2import time
3
4# Initialize the HUD
5h = hud.Hud()
6
7# Create a window with a specific title
8window = h.add_window("Training Metrics")
9
10# Add a metric or value to the display
11loss_metric = window.add_metric("Loss", value=0.0)
12step_metric = window.add_metric("Step", value=0)
13
14# Simulate a training loop updating the HUD
15for i in range(100):
16    # Update values in real-time
17    loss_metric.update(1.0 / (i + 1))
18    step_metric.update(i)
19    
20    # Refresh/render the HUD
21    h.render()
22    
23    time.sleep(0.1)