Feature/gap1 training history#331
Open
Sickwoman wants to merge 1 commit intoc2siorg:mainfrom
Open
Conversation
669ffa2 to
57274d9
Compare
- Add ModelTrainingRun table to capture every training run
- Store timing, config snapshot, final metrics, epoch-by-epoch curves
- Save history in model_run.py after model.fit() completes
- Add 3 new endpoints:
GET /api/model/{model_id}/training-runs
GET /api/model/{model_id}/training-run/{run_id}/metrics
POST /api/model/{model_id}/training-run/{run_id}/set-as-best
- Alembic migration: 9e13d23b8149
- Register ModelTrainingRun in migrations/env.py
57274d9 to
17dd64a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds critical improvements to the GAP-1 training history feature:
Problem Statement
Solution
Backend Changes
1. Error Handling in model_run() (
model_run.py)training_run.status = "failed"training_run.error_message = str(e)Example flow:
2. Pagination on Training Runs Endpoint (
training_run.py)offsetandlimitquery parametersoffset=0, limit=50returned_runscount along with pagination infoQuery example:
Response:
{ "model_id": 123, "model_name": "my-model", "returned_runs": 50, "offset": 0, "limit": 50, "runs": [...] }3. Logging Improvements
training_run.py4. Metric Validation
Testing
Backwards Compatibility
✅ Fully backwards compatible:
Files Changed
tensormap-backend/app/services/model_run.py— Error handling wrappertensormap-backend/app/routers/training_run.py— Pagination + loggingKey Features
✅ Training failures now tracked with error messages
✅ Pagination prevents memory issues with large datasets
✅ Comprehensive logging for debugging
✅ Metric validation warns on mismatches
✅ All 162 tests passing
✅ Ruff linting passes
Related
Improves GAP-1 training history feature with production-ready error handling and performance optimizations.