Appearance
Track training runs
klars shows the training data your script reports: metrics, configuration, checkpoint references, and evaluation associations. It does not automatically capture your training steps.
Prepare the tracker
You need the standalone klars_track.py file beside your training script, or on PYTHONPATH. It uses the Python standard library and needs no tracker-specific pip package. A public tracker download is not linked from this site yet; obtain the tracker file with your klars distribution.
Start klars on the same computer, then run your script from the project folder. The tracker finds the service through its private ~/.klars/app/server.json record.
Log your first run
Add the tracker to your existing training loop. The highlighted lines are the reporting calls:
python
import klars_track
run = klars_track.init(name="baseline", config={"lr": 0.01})
for step in range(steps):
loss = train_step()
run.log({"loss": float(loss)}, step=step)
run.finish()steps and train_step() belong to your training script. Open Experiments in klars to see the run and its metrics.
Without an explicit project ID, the tracker uses the nearest parent with .klars/, then the Git root, then the current directory. It records the Git revision, dirty state, and command-line arguments with the run. Keep credentials out of command-line arguments.
Record configuration and checkpoints
A context manager finishes the run on exit and marks an exception as a failure:
python
with klars_track.init(
name="lower learning rate",
config={"lr": 0.001},
tags=["ablation"],
) as run:
for step in range(steps):
loss = train_step()
run.log({"loss": float(loss)}, step=step)
run.checkpoint("weights.pt", step=steps)Checkpoint and artifact calls record references; they are not automatic cloud uploads. Pass parentRunId, sourceCheckpointId, or captureId to init() when you know the relationship you want Lineage to record.
Know what was delivered
By default, reporting queues data in memory on a background thread. Requests retry if the service is unavailable; the oldest entries can be dropped when the queue fills.
finish() waits up to ten seconds by default and returns whether everything was delivered. Unsaved queue data is lost when the process exits. Use strict=True when you need synchronous responses or reporting errors to raise. With forked data-loader processes, report from the training parent.
Report from a container or another machine
- Open Settings › Experiments › Tracking tokens and choose Create token.
- Copy the token and environment block immediately. The token is shown once and expires after 24 hours.
- Make the service address reachable from the training environment, for example through SSH forwarding. A loopback URL on another computer refers to that computer, so adjust the tunnel and port accordingly.
- Set
KLARS_URLandKLARS_TOKENin the training process. Use the project-specific Python snippet shown by Settings.
A tracking token can record runs, metrics, artifact references, and results. It cannot read the workspace or run commands. It covers the service rather than a single project. Revoke it in the same settings section when finished.
Next, read your runs in Lineage.