Skip to content

Commit 3cbe554

Browse files
Restore helpful comments in documentation code examples
Co-authored-by: Samuel <samuel@knutsen.co>
1 parent e2eaeb9 commit 3cbe554

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

AGENTS_DOC.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,35 +158,49 @@ from tensorbored.plugins.core import profile_writer, color_sampler
158158

159159
p = profile_writer.create_profile(
160160
'Training Monitor',
161+
162+
# Pin your most important metrics at the top
161163
pinned_cards=[
162164
profile_writer.pin_scalar('train/loss'),
163165
profile_writer.pin_scalar('eval/loss'),
164166
profile_writer.pin_scalar('train/accuracy'),
165167
profile_writer.pin_scalar('eval/accuracy'),
166168
profile_writer.pin_scalar('learning_rate'),
167169
],
170+
171+
# Create comparison charts
168172
superimposed_cards=[
169173
profile_writer.create_superimposed_card(
170174
title='Train vs Eval Loss',
171175
tags=['train/loss', 'eval/loss'],
172176
),
173177
],
178+
179+
# Assign colors to runs
174180
run_colors={
175181
'baseline': '#9E9E9E',
176182
'experiment_v1': '#2196F3',
177183
'experiment_v2': '#4CAF50',
178184
},
185+
186+
# Add metric descriptions (shown as hover tooltips)
179187
metric_descriptions={
180188
'train/loss': 'Cross-entropy loss on the training set.',
181189
'eval/loss': 'Cross-entropy loss on the held-out validation set.',
182190
'learning_rate': 'Effective learning rate after warmup and cosine decay.',
183191
},
192+
193+
# Default filter and smoothing
184194
tag_filter='loss|accuracy|learning_rate',
185195
smoothing=0.8,
196+
197+
# Group runs by regex pattern
186198
group_by={
187199
'key': 'regex',
188200
'regexString': r'(baseline|experiment)',
189201
},
202+
203+
# Control which sections are expanded on load
190204
expanded_tag_groups={
191205
'train': True,
192206
'eval': True,

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Set up default dashboard configurations from your training code using the
9898
```python
9999
from tensorbored.plugins.core import profile_writer
100100

101+
# Create a profile for your experiment
101102
p = profile_writer.create_profile(
102103
'Training Monitor',
103104
pinned_cards=[
@@ -117,6 +118,8 @@ p = profile_writer.create_profile(
117118
'eval/accuracy': 'Top-1 accuracy on the validation set.',
118119
},
119120
)
121+
122+
# Writes to <logdir>/.tensorboard/default_profile.json
120123
p.write('/path/to/logs')
121124
```
122125

0 commit comments

Comments
 (0)