File size: 8,357 Bytes
32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 00d1de8 32e3089 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CTM Training Dashboard</title>
<style>
:root {
--bg-color: #f4f4f9;
--card-bg: #ffffff;
--text-color: #333;
--accent-color: #4a90e2;
--success-color: #2ecc71;
--font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
body {
font-family: var(--font-family);
background-color: var(--bg-color);
color: var(--text-color);
margin: 0;
padding: 20px;
line-height: 1.6;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 40px;
}
h1 {
color: var(--accent-color);
margin-bottom: 10px;
}
.status-card {
background: var(--card-bg);
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 30px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
text-align: center;
}
.metric {
display: flex;
flex-direction: column;
}
.metric-label {
font-size: 0.9em;
color: #666;
}
.metric-value {
font-size: 1.5em;
font-weight: bold;
color: var(--text-color);
}
.plots-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.plot-card {
background: var(--card-bg);
padding: 15px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.plot-card img {
width: 100%;
height: auto;
border-radius: 4px;
}
.artifacts-section {
background: var(--card-bg);
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
text-align: center;
margin-bottom: 30px;
}
.btn {
display: inline-block;
padding: 10px 20px;
background-color: var(--accent-color);
color: white;
text-decoration: none;
border-radius: 5px;
margin: 0 10px;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #357abd;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 15px;
margin-top: 20px;
}
.gallery img {
width: 100%;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
footer {
text-align: center;
margin-top: 50px;
color: #888;
font-size: 0.9em;
}
#last-updated {
font-size: 0.8em;
color: #999;
margin-top: 5px;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>CTM Training Dashboard</h1>
<p>Real-time monitoring of Energy-Based Halting Experiment</p>
<div id="last-updated">Waiting for data...</div>
</header>
<div class="status-card" id="metrics-container">
<div class="metric">
<span class="metric-label">Iteration</span>
<span class="metric-value" id="iter">--</span>
</div>
<div class="metric">
<span class="metric-label">Epoch</span>
<span class="metric-value" id="epoch">--</span>
</div>
<div class="metric">
<span class="metric-label">Train Loss</span>
<span class="metric-value" id="train-loss">--</span>
</div>
<div class="metric">
<span class="metric-label">Test Loss</span>
<span class="metric-value" id="test-loss">--</span>
</div>
<div class="metric">
<span class="metric-label">Train Acc</span>
<span class="metric-value" id="train-acc">--</span>
</div>
<div class="metric">
<span class="metric-label">Test Acc</span>
<span class="metric-value" id="test-acc">--</span>
</div>
</div>
<div class="plots-grid">
<div class="plot-card">
<h3>Loss History</h3>
<img
id="loss-plot"
src="logs/scratch/losses.png"
alt="Loss Plot"
onerror="this.src='https://via.placeholder.com/600x400?text=Waiting+for+Plots'"
/>
</div>
<div class="plot-card">
<h3>Accuracy History</h3>
<img
id="acc-plot"
src="logs/scratch/accuracies.png"
alt="Accuracy Plot"
onerror="this.src='https://via.placeholder.com/600x400?text=Waiting+for+Plots'"
/>
</div>
</div>
<div class="artifacts-section">
<h2>Artifacts & Downloads</h2>
<p>Download the latest model checkpoints and full logs.</p>
<a href="logs/scratch/artifacts.zip" class="btn"
>Download All Artifacts (.zip)</a
>
<a href="logs/scratch/checkpoint.pt" class="btn"
>Download Checkpoint (.pt)</a
>
</div>
<div class="artifacts-section">
<h2>Attention Visualization</h2>
<p>Latest generated attention maps from the model.</p>
<div class="gallery" id="gif-gallery">
<!-- GIFs will be injected here -->
<img
src="logs/scratch/0_attention.gif"
onerror="this.style.display='none'"
alt="Attention Map"
/>
</div>
</div>
</div>
<footer>
<p>Continuous Thought Machine Experiment</p>
</footer>
<script>
const LOG_DIR = "logs/scratch";
async function updateDashboard() {
try {
// Fetch status.json
const response = await fetch(
`${LOG_DIR}/status.json?t=${new Date().getTime()}`
);
if (!response.ok) throw new Error("Status file not found");
const data = await response.json();
// Update Metrics
document.getElementById(
"iter"
).textContent = `${data.iteration} / ${data.total_iterations}`;
document.getElementById("epoch").textContent = data.epoch;
document.getElementById("train-loss").textContent = parseFloat(
data.train_loss
).toFixed(4);
document.getElementById("test-loss").textContent = parseFloat(
data.test_loss
).toFixed(4);
// Handle Accuracy (could be array or float)
const formatAcc = (acc) => {
if (Array.isArray(acc)) {
return (acc[acc.length - 1] * 100).toFixed(2) + "%";
}
return (acc * 100).toFixed(2) + "%";
};
document.getElementById("train-acc").textContent = formatAcc(
data.train_accuracy
);
document.getElementById("test-acc").textContent = formatAcc(
data.test_accuracy
);
// Update Timestamp
document.getElementById(
"last-updated"
).textContent = `Last updated: ${new Date().toLocaleTimeString()}`;
// Refresh Images
const timestamp = new Date().getTime();
document.getElementById(
"loss-plot"
).src = `${LOG_DIR}/losses.png?t=${timestamp}`;
document.getElementById(
"acc-plot"
).src = `${LOG_DIR}/accuracies.png?t=${timestamp}`;
// Refresh Gallery (simple approach: try to reload the known gif)
const gallery = document.getElementById("gif-gallery");
gallery.innerHTML = `<img src="${LOG_DIR}/0_attention.gif?t=${timestamp}" onerror="this.style.display='none'" alt="Attention Map">`;
} catch (error) {
console.log("Waiting for training to start...", error);
document.getElementById("last-updated").textContent =
"Waiting for training to start...";
}
}
// Update every 30 seconds
setInterval(updateDashboard, 30000);
// Initial call
updateDashboard();
</script>
</body>
</html>
|