model checkpoints

This commit is contained in:
Dobromir Popov
2025-06-26 01:12:36 +03:00
parent 0ae52f0226
commit 5e57e7817e
5 changed files with 75 additions and 13 deletions

View File

@ -366,9 +366,13 @@ class DashboardComponentManager:
pred_action = last_prediction.get('action', 'NONE')
pred_confidence = last_prediction.get('confidence', 0)
# 5MA Loss
# 5MA Loss - with safe comparison handling
loss_5ma = model_info.get('loss_5ma', 0.0)
loss_class = "text-success" if loss_5ma < 0.1 else "text-warning" if loss_5ma < 0.5 else "text-danger"
if loss_5ma is None:
loss_5ma = 0.0
loss_class = "text-muted"
else:
loss_class = "text-success" if loss_5ma < 0.1 else "text-warning" if loss_5ma < 0.5 else "text-danger"
# Model size/parameters
model_size = model_info.get('parameters', 0)
@ -381,14 +385,20 @@ class DashboardComponentManager:
else:
size_str = str(model_size)
# Get checkpoint filename for tooltip
checkpoint_filename = model_info.get('checkpoint_filename', 'No checkpoint info')
checkpoint_status = "LOADED" if model_info.get('checkpoint_loaded', False) else "FRESH"
# Model card
model_card = html.Div([
# Header with model name and toggle
html.Div([
html.Div([
html.I(className=f"{status_icon} me-2 {status_class}"),
html.Strong(f"{model_name.upper()}", className=status_class),
html.Span(f" ({size_str} params)", className="text-muted small ms-2")
html.Strong(f"{model_name.upper()}", className=status_class,
title=f"Checkpoint: {checkpoint_filename}"),
html.Span(f" ({size_str} params)", className="text-muted small ms-2"),
html.Span(f" [{checkpoint_status}]", className=f"small {'text-success' if checkpoint_status == 'LOADED' else 'text-warning'} ms-1")
], style={"flex": "1"}),
# Activation toggle (if easy to implement)