gradia 1.0.0__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. gradia-2.0.0/PKG-INFO +394 -0
  2. gradia-2.0.0/README.md +326 -0
  3. gradia-2.0.0/gradia/__init__.py +38 -0
  4. {gradia-1.0.0 → gradia-2.0.0}/gradia/cli/main.py +1 -1
  5. gradia-2.0.0/gradia/core/config.py +114 -0
  6. gradia-2.0.0/gradia/core/migration.py +324 -0
  7. gradia-2.0.0/gradia/events/__init__.py +17 -0
  8. gradia-2.0.0/gradia/events/logger.py +215 -0
  9. gradia-2.0.0/gradia/events/models.py +170 -0
  10. gradia-2.0.0/gradia/events/tracker.py +337 -0
  11. {gradia-1.0.0 → gradia-2.0.0}/gradia/trainer/engine.py +175 -3
  12. {gradia-1.0.0 → gradia-2.0.0}/gradia/viz/server.py +153 -17
  13. gradia-2.0.0/gradia/viz/static/css/timeline.css +419 -0
  14. gradia-2.0.0/gradia/viz/static/js/timeline.js +471 -0
  15. {gradia-1.0.0 → gradia-2.0.0}/gradia/viz/templates/configure.html +1 -1
  16. {gradia-1.0.0 → gradia-2.0.0}/gradia/viz/templates/index.html +11 -9
  17. gradia-2.0.0/gradia/viz/templates/timeline.html +195 -0
  18. gradia-2.0.0/gradia.egg-info/PKG-INFO +394 -0
  19. {gradia-1.0.0 → gradia-2.0.0}/gradia.egg-info/SOURCES.txt +8 -0
  20. gradia-2.0.0/gradia.egg-info/requires.txt +20 -0
  21. gradia-2.0.0/pyproject.toml +81 -0
  22. gradia-2.0.0/tests/test_gradia.py +531 -0
  23. gradia-1.0.0/PKG-INFO +0 -143
  24. gradia-1.0.0/README.md +0 -92
  25. gradia-1.0.0/gradia/__init__.py +0 -1
  26. gradia-1.0.0/gradia/core/config.py +0 -56
  27. gradia-1.0.0/gradia.egg-info/PKG-INFO +0 -143
  28. gradia-1.0.0/gradia.egg-info/requires.txt +0 -11
  29. gradia-1.0.0/pyproject.toml +0 -45
  30. gradia-1.0.0/tests/test_gradia.py +0 -134
  31. {gradia-1.0.0 → gradia-2.0.0}/LICENSE +0 -0
  32. {gradia-1.0.0 → gradia-2.0.0}/MANIFEST.in +0 -0
  33. {gradia-1.0.0 → gradia-2.0.0}/gradia/cli/__init__.py +0 -0
  34. {gradia-1.0.0 → gradia-2.0.0}/gradia/core/inspector.py +0 -0
  35. {gradia-1.0.0 → gradia-2.0.0}/gradia/core/scenario.py +0 -0
  36. {gradia-1.0.0 → gradia-2.0.0}/gradia/models/base.py +0 -0
  37. {gradia-1.0.0 → gradia-2.0.0}/gradia/models/sklearn_wrappers.py +0 -0
  38. {gradia-1.0.0 → gradia-2.0.0}/gradia/trainer/callbacks.py +0 -0
  39. {gradia-1.0.0 → gradia-2.0.0}/gradia/viz/assets/logo.png +0 -0
  40. {gradia-1.0.0 → gradia-2.0.0}/gradia/viz/static/css/style.css +0 -0
  41. {gradia-1.0.0 → gradia-2.0.0}/gradia/viz/static/js/app.js +0 -0
  42. {gradia-1.0.0 → gradia-2.0.0}/gradia.egg-info/dependency_links.txt +0 -0
  43. {gradia-1.0.0 → gradia-2.0.0}/gradia.egg-info/entry_points.txt +0 -0
  44. {gradia-1.0.0 → gradia-2.0.0}/gradia.egg-info/top_level.txt +0 -0
  45. {gradia-1.0.0 → gradia-2.0.0}/setup.cfg +0 -0
gradia-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,394 @@
1
+ Metadata-Version: 2.4
2
+ Name: gradia
3
+ Version: 2.0.0
4
+ Summary: Local-first ML training visualization with Learning Timeline - watch how your model learns sample by sample.
5
+ Author-email: STiFLeR <hillaniljppatel@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 STiFLeR
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/STiFLeR7/gradia
29
+ Project-URL: Bug Tracker, https://github.com/STiFLeR7/gradia/issues
30
+ Project-URL: Documentation, https://github.com/STiFLeR7/gradia#readme
31
+ Project-URL: Changelog, https://github.com/STiFLeR7/gradia/blob/master/RELEASE_NOTES.md
32
+ Keywords: machine-learning,dashboard,visualization,tracking,mlops,timeline,training-monitor
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.9
35
+ Classifier: Programming Language :: Python :: 3.10
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: License :: OSI Approved :: MIT License
39
+ Classifier: Operating System :: OS Independent
40
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
41
+ Classifier: Topic :: System :: Monitoring
42
+ Classifier: Development Status :: 4 - Beta
43
+ Classifier: Intended Audience :: Developers
44
+ Classifier: Intended Audience :: Science/Research
45
+ Requires-Python: >=3.9
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Requires-Dist: scikit-learn>=1.0
49
+ Requires-Dist: pandas>=1.3
50
+ Requires-Dist: numpy>=1.20
51
+ Requires-Dist: fastapi>=0.68
52
+ Requires-Dist: uvicorn>=0.15
53
+ Requires-Dist: typer>=0.4
54
+ Requires-Dist: jinja2>=3.0
55
+ Requires-Dist: rich>=10.0
56
+ Requires-Dist: psutil>=5.8
57
+ Requires-Dist: tqdm>=4.60
58
+ Requires-Dist: pyyaml>=6.0
59
+ Provides-Extra: dev
60
+ Requires-Dist: pytest>=7.0; extra == "dev"
61
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
62
+ Requires-Dist: flake8>=6.0; extra == "dev"
63
+ Requires-Dist: black>=23.0; extra == "dev"
64
+ Requires-Dist: build>=0.10; extra == "dev"
65
+ Requires-Dist: twine>=4.0; extra == "dev"
66
+ Requires-Dist: httpx>=0.24.0; extra == "dev"
67
+ Dynamic: license-file
68
+
69
+ <div align="center">
70
+
71
+ # G R A D I A
72
+
73
+ **Next-Generation Local-First ML Training Visualization**
74
+
75
+ [![PyPI Version](https://img.shields.io/pypi/v/gradia?style=for-the-badge&color=blue)](https://pypi.org/project/gradia/)
76
+ [![Python Version](https://img.shields.io/badge/Python-3.9%2B-blue?style=for-the-badge&logo=python&logoColor=white)](https://python.org)
77
+ [![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE)
78
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/STiFLeR7/gradia/ci-update.yaml?style=for-the-badge)](https://github.com/STiFLeR7/gradia/actions)
79
+
80
+ *From observing training to understanding learning.*
81
+
82
+ <p align="center">
83
+ <img src="assets/dashboard.png" alt="Gradia Dashboard" width="100%" />
84
+ </p>
85
+
86
+ </div>
87
+
88
+ ---
89
+
90
+ ## 🚀 What's New in v2.0.0
91
+
92
+ **Gradia v2.0.0** introduces the **Learning Timeline** — a real-time, sample-centric view of how your models learn over time. This release transforms Gradia from a metrics dashboard into a **learning behavior explorer**.
93
+
94
+ ### ✨ Flagship Feature: Learning Timeline
95
+
96
+ The Learning Timeline answers questions that aggregate metrics cannot:
97
+
98
+ - 🎯 **When did this sample become correctly classified?**
99
+ - 🔄 **Which samples keep flipping predictions?**
100
+ - 📈 **Is the model memorizing or stabilizing?**
101
+ - ⚠️ **Which data points drive learning instability?**
102
+
103
+ <p align="center">
104
+ <img src="assets/experiment.png" alt="Learning Timeline" width="100%" />
105
+ </p>
106
+
107
+ ---
108
+
109
+ ## 📖 Overview
110
+
111
+ **Gradia** is a high-performance, local-first monitoring solution for machine learning workflows. Unlike cloud-native platforms, Gradia focuses on **zero-latency**, **privacy-first** tracking that runs directly alongside your training loop.
112
+
113
+ Built on **FastAPI** and a **Reactive UI**, Gradia provides granular visibility into your model's training dynamics, system resources, and now — individual sample learning behavior.
114
+
115
+ ---
116
+
117
+ ## ⚡ Key Features
118
+
119
+ | Feature | Description |
120
+ | :--- | :--- |
121
+ | **🔬 Learning Timeline** | Track how individual samples evolve during training with real-time visualization |
122
+ | **📊 Real-Time Telemetry** | Nanosecond-precision tracking of Loss, Accuracy, and custom metrics |
123
+ | **🧠 Intelligent Auto-Discovery** | Automatic task type inference (Classification vs Regression) and model suggestions |
124
+ | **💻 System Profiling** | CPU and RAM monitoring during training epochs |
125
+ | **📁 Artifact Management** | Automated checkpointing and structured logging (`events.jsonl`) |
126
+ | **📋 Comprehensive Reporting** | One-click PDF/JSON reports with full training history |
127
+ | **🔄 Backward Compatible** | Full support for v1.x runs with automatic migration |
128
+
129
+ ---
130
+
131
+ ## 🔬 Learning Timeline Deep Dive
132
+
133
+ ### How It Works
134
+
135
+ The Learning Timeline tracks a bounded subset of samples (default: 100) throughout training, capturing:
136
+
137
+ - **Prediction** — What the model predicts for each sample
138
+ - **Confidence** — Model's certainty in its prediction
139
+ - **Correctness** — Whether the prediction matches the true label
140
+ - **Flip Events** — When predictions change between epochs
141
+
142
+ ### Sample Classification
143
+
144
+ Gradia automatically classifies tracked samples into categories:
145
+
146
+ | Category | Description | Visual |
147
+ | :--- | :--- | :--- |
148
+ | **Stable Correct** | Consistently correct predictions | 🟢 Green |
149
+ | **Late Learner** | Became correct after epoch N | 🟡 Yellow |
150
+ | **Unstable** | Predictions flip frequently | 🟠 Orange |
151
+ | **Persistent Error** | Never correctly classified | 🔴 Red |
152
+
153
+ ### UI Blocks
154
+
155
+ The Timeline interface is organized into focused blocks:
156
+
157
+ 1. **Block A: Timeline Overview** — High-level view of learning stability across all tracked samples
158
+ 2. **Block B: Sample Inspector** — Deep-dive into individual sample trajectories with confidence curves
159
+ 3. **Block C: Instability Panel** — Top flipping samples, late learners, and persistent errors
160
+ 4. **Block D: Training Context** — Current epoch, status, and tracking metadata
161
+
162
+ ---
163
+
164
+ ## 🛠️ Architecture
165
+
166
+ Gradia employs a **Producer-Consumer** architecture:
167
+
168
+ ```
169
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
170
+ │ Trainer Thread │───▶│ Event Queue │───▶│ FastAPI UI │
171
+ │ (Producer) │ │ (Thread-Safe) │ │ (Consumer) │
172
+ └─────────────────┘ └─────────────────┘ └─────────────────┘
173
+ │ │
174
+ ▼ ▼
175
+ ┌─────────────────┐ ┌─────────────────┐
176
+ │ Sample Tracker │ │ Timeline Logger │
177
+ │ (v2.0 New) │ │ (v2.0 New) │
178
+ └─────────────────┘ └─────────────────┘
179
+ ```
180
+
181
+ ### New v2.0 Components
182
+
183
+ - **`gradia.events`** — Event model with `LearningEvent`, `SampleState`, `EpochSummary`
184
+ - **`SampleTracker`** — Boundary-aware sample selection and tracking
185
+ - **`TimelineLogger`** — Structured timeline event persistence
186
+ - **`SchemaMigrator`** — Automatic v1.x to v2.0 config migration
187
+
188
+ ---
189
+
190
+ ## 📦 Installation
191
+
192
+ ```bash
193
+ pip install gradia --upgrade
194
+ ```
195
+
196
+ ### From Source
197
+
198
+ ```bash
199
+ git clone https://github.com/STiFLeR7/gradia.git
200
+ cd gradia
201
+ pip install -e ".[dev]"
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 💻 Quick Start
207
+
208
+ ### Basic Usage
209
+
210
+ ```bash
211
+ # Auto-detect datasets and start the dashboard
212
+ gradia run .
213
+ ```
214
+
215
+ ### Advanced CLI
216
+
217
+ ```bash
218
+ # Specify target column and port
219
+ gradia run . --target "label" --port 8080
220
+ ```
221
+
222
+ ### Python API
223
+
224
+ ```python
225
+ from gradia.trainer.engine import Trainer
226
+ from gradia.core.scenario import ScenarioInferrer
227
+ from gradia.core.config import ConfigManager
228
+
229
+ # Infer scenario from dataset
230
+ inferrer = ScenarioInferrer()
231
+ scenario = inferrer.infer("data.csv", target_override="label")
232
+
233
+ # Configure training with timeline enabled
234
+ config_mgr = ConfigManager("./runs")
235
+ config = config_mgr.load_or_create()
236
+ config['model']['type'] = 'random_forest'
237
+ config['training']['epochs'] = 20
238
+ config['timeline']['enabled'] = True
239
+ config['timeline']['max_samples'] = 100
240
+
241
+ # Run training
242
+ trainer = Trainer(scenario, config, "./runs")
243
+ trainer.run()
244
+
245
+ # Get timeline insights
246
+ insights = trainer.get_timeline_insights()
247
+ print(f"Stable samples: {insights['stable_correct']}")
248
+ print(f"Flipping samples: {insights['top_flippers']}")
249
+ ```
250
+
251
+ ---
252
+
253
+ ## 📊 Dashboard
254
+
255
+ Access the dashboard at `http://localhost:8000` after running `gradia run .`
256
+
257
+ ### Pages
258
+
259
+ | Page | URL | Description |
260
+ | :--- | :--- | :--- |
261
+ | **Configure** | `/configure` | Select model, hyperparameters, and start training |
262
+ | **Metrics** | `/` | Real-time training metrics and system resources |
263
+ | **Timeline** | `/timeline` | Learning Timeline visualization (v2.0) |
264
+
265
+ ### Configuration Options
266
+
267
+ ```yaml
268
+ # Example gradia_config.yaml (auto-generated)
269
+ schema_version: "2.0"
270
+ project_name: "my-experiment"
271
+ save_model: true
272
+
273
+ model:
274
+ type: "random_forest"
275
+ params:
276
+ n_estimators: 100
277
+ max_depth: null
278
+
279
+ training:
280
+ epochs: 20
281
+ test_split: 0.2
282
+ random_seed: 42
283
+
284
+ timeline:
285
+ enabled: true
286
+ max_samples: 100
287
+ sampling_strategy: "boundary"
288
+ ```
289
+
290
+ ---
291
+
292
+ ## 🔄 Migration from v1.x
293
+
294
+ Gradia v2.0 is **fully backward compatible**. When you run `gradia run .` on a v1.x project:
295
+
296
+ 1. Existing configs are automatically migrated to v2.0 schema
297
+ 2. Old runs remain accessible
298
+ 3. Timeline features are enabled by default
299
+
300
+ ```bash
301
+ # Migration happens automatically
302
+ gradia run .
303
+ # Output: Config migrated: Added timeline config, Set schema_version to 2.0
304
+ ```
305
+
306
+ ---
307
+
308
+ ## 🧪 Testing
309
+
310
+ ```bash
311
+ # Run all tests
312
+ pytest tests/ -v
313
+
314
+ # Run with coverage
315
+ pytest tests/ --cov=gradia --cov-report=html
316
+ ```
317
+
318
+ ---
319
+
320
+ ## 📁 Project Structure
321
+
322
+ ```
323
+ gradia/
324
+ ├── cli/ # Typer CLI application
325
+ ├── core/ # Configuration, inspection, migration
326
+ ├── events/ # v2.0 Event model and tracking
327
+ │ ├── models.py # LearningEvent, SampleState, EpochSummary
328
+ │ ├── tracker.py # SampleTracker with boundary sampling
329
+ │ └── logger.py # TimelineLogger for event persistence
330
+ ├── models/ # sklearn wrappers and model factory
331
+ ├── trainer/ # Training engine with timeline integration
332
+ └── viz/ # FastAPI server and UI templates
333
+ ├── templates/ # Jinja2 HTML templates
334
+ └── static/ # CSS and JavaScript
335
+ ```
336
+
337
+ ---
338
+
339
+ ## 🗺️ Roadmap
340
+
341
+ ### v2.1 (Planned)
342
+ - [ ] WebSocket real-time updates
343
+ - [ ] Dataset Intelligence Panel
344
+ - [ ] Experiment Comparison (overlay 2-3 runs)
345
+ - [ ] Export timeline to video/GIF
346
+
347
+ ### v2.2 (Future)
348
+ - [ ] PyTorch integration
349
+ - [ ] TensorFlow/Keras support
350
+ - [ ] Remote monitoring mode
351
+
352
+ ---
353
+
354
+ ## 🤝 Contributing
355
+
356
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
357
+
358
+ ```bash
359
+ # Development setup
360
+ git clone https://github.com/STiFLeR7/gradia.git
361
+ cd gradia
362
+ pip install -e ".[dev]"
363
+
364
+ # Run tests
365
+ pytest tests/ -v
366
+
367
+ # Lint
368
+ flake8 gradia/
369
+ ```
370
+
371
+ ---
372
+
373
+ ## 📄 License
374
+
375
+ Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
376
+
377
+ ---
378
+
379
+ ## 🔗 Links
380
+
381
+ - **PyPI**: [pypi.org/project/gradia](https://pypi.org/project/gradia/)
382
+ - **GitHub**: [github.com/STiFLeR7/gradia](https://github.com/STiFLeR7/gradia)
383
+ - **Hugging Face**: [huggingface.co/STiFLeR7](https://huggingface.co/STiFLeR7)
384
+ - **Issues**: [github.com/STiFLeR7/gradia/issues](https://github.com/STiFLeR7/gradia/issues)
385
+
386
+ ---
387
+
388
+ <div align="center">
389
+ <sub>Built with ❤️ by <strong>STiFLeR</strong> for the ML Community.</sub>
390
+ <br><br>
391
+ <a href="https://instagram.com/stifler.xd">Instagram</a> •
392
+ <a href="https://huggingface.co/STiFLeR7">Hugging Face</a> •
393
+ <a href="https://pypi.org/user/stifler.xd/">PyPI</a>
394
+ </div>