losslint
Lint your training logs — live or after the run. Point losslint at the metrics
file your trainer already writes (a HuggingFace trainer_state.json, a CSV of
step,loss,lr, a JSONL of metric dicts, or a TensorBoard event file) and get a
lint report: NaN poisoning, divergence, loss spikes, overfitting onset, and
step-logging bugs — with CI-friendly exit codes. No instrumentation, no cloud,
CPU-only.
Install
pip install losslint # zero-runtime-dependency core
pip install "losslint[fast]" # + numpy-accelerated checks
pip install "losslint[tb]" # + TensorBoard event file support
Requires Python ≥ 3.10.
Quick start
losslint check runs/ # lint every supported log under a directory
losslint check metrics.csv --loss-col l --eval-loss-col e
losslint watch runs/exp1/metrics.jsonl --interval 5 # tail a live run
losslint demo demo_logs && losslint check demo_logs # try the planted-defect demos
Text report (fixed-grid sparklines with a flat baseline):
losslint 0.4.1 · 1 run(s) · 1 finding(s)
nan.jsonl · 40 points · 1 error
loss │█▇▇▆▆▅▅▄▄▄▃▃▃▃▂▂▂▂!▂▁▁▁▁│ 1.8 → 0.243
error nan_inf series 'loss' has 1 NaN/Inf value(s) (first steps: 30) — every metric after this is suspect
1 finding(s) · 1 error · exit 1 (fail-severity: error)
The ! marks a NaN/Inf break before you read a single finding.
Checks
| check | severity | what it flags |
|---|---|---|
nan_inf |
error | NaN/Inf in any numeric series |
divergence |
error | train loss ends materially higher than it started |
loss_spike |
warning | isolated point above 10× the local rolling median |
step_backtrack |
warning | strictly decreasing step indices |
overfit_onset |
info | eval loss worsening while train loss still improves |
stagnation |
info | < 1% train-loss improvement over the last quarter |
parse |
warning | malformed log lines skipped |
Exit codes: 0 clean, 1 findings at/above --fail-severity, 2 usage/parse error.
In CI
- run: pip install losslint && losslint check runs/ --fail-severity error
Or use the bundled action:
- uses: Lsyyh/losslint@v0.4
with:
files: runs/
License
MIT
Metadata
Release files for losslint 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| losslint-0.4.1.tar.gz | 25.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| losslint-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.3 kB
Release files / losslint-0.4.1.tar.gz
| Download URL | losslint-0.4.1.tar.gz |
|---|---|
| Size | 25.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d9aebdbc4ad59365ffb8b817c33991edfadf1b2a894d3f7b726af0dcc923f7b
|
|
BLAKE2b-256 checksum How to use checksums |
4ad3d6af8b2c2d1a7c1e79596f496fb0a561ace91e598a62f36f09c515aed429
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / losslint-0.4.1-py3-none-any.whl
| Download URL | losslint-0.4.1-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38fb4c038f3a05318969005fdfd1db51ecfdaba7263d87b3aa87e07103d7b106
|
|
BLAKE2b-256 checksum How to use checksums |
3ed6ac34d5605ad22ae68d17b7a6c83484612366795ed83c89ecd4745f69c84d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|