A lightweight Python tool to visualize and analyze machine learning training loss curves from JSON/JSONL logs, with built-in smoothing, metrics calculation, and outlier detection.
- Parses JSON, JSONL, and single-quoted Python dict logs
- Robust smoothing (SciPy or NumPy fallback moving average)
- Calculates key metrics: slope, SNR, best loss, variance, exposure
- Outlier detection using Median Absolute Deviation (MAD)
- Interactive Tkinter GUI with plot export and clipboard support
- CLI mode for headless use
- Python 3.8+
- Core:
matplotlib,numpy - Optional:
scipy(faster smoothing),pyperclip(clipboard copy)
Install dependencies:
pip install -r requirements.txtpython lense.py- Paste or load JSONL logs into the input box
- Click "Analyze Now" or press Ctrl+Enter
- View metrics and interactive loss plot
- Export metrics to clipboard or Markdown
python lense.py path/to/training_logs.jsonlLogs must contain a loss key (required), with optional fields like epoch, learning_rate, etc.:
{"loss": 0.52, "epoch": 1.0, "step": 100}
{"loss": 0.48, "epoch": 1.1, "step": 110}- Replaced naive single-quote regex with
ast.literal_evalfor safer log parsing - Removed unused
calculate_gradedead code - Fixed outlier detection to use MAD instead of standard deviation
- Corrected epoch boundary detection to trigger on whole epoch transitions
- Added
requirements.txtand this README