Conversation
…onfig Agent-Logs-Url: https://github.com/theomgdev/OdyssNet/sessions/66baa6ed-4846-4834-9232-e1a9d6ac7037 Co-authored-by: theomgdev <29312699+theomgdev@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
theomgdev
April 13, 2026 23:21
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens trainer input/runtime invariants, reduces per-step overhead in the input preparation path by vectorizing feature-to-neuron mapping, and removes duplicated pytest configuration to avoid config drift.
Changes:
- Added early validation in
OdyssNetTrainer.train_batch()andfit()for common invalid/edge-case inputs. - Vectorized
prepare_input()feature assignment for both 2D and 3D inputs. - Added regression tests for the new trainer invariants and removed duplicate pytest config from
pyproject.toml.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
odyssnet/training/trainer.py |
Adds early validation for gradient_accumulation_steps, batch_size, and dataset shape invariants. |
odyssnet/utils/data.py |
Replaces per-feature Python loops with vectorized indexed assignment in prepare_input(). |
tests/training/test_trainer.py |
Adds tests covering invalid accumulation steps, empty dataset, length mismatch, and invalid batch size. |
pyproject.toml |
Removes [tool.pytest.ini_options] so pytest.ini is the single source of truth. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Summary
This PR addresses concrete quality issues by tightening trainer/runtime invariants, removing hot-path inefficiencies in input preparation, and resolving config drift between pytest config files. Scope is surgical: correctness under edge conditions, lower per-step overhead, and cleaner project structure.
Changes
Trainer safety invariants
gradient_accumulation_stepsintrain_batch(intand>= 1).fitinputs early:batch_size >= 1input_features/target_valueslength match.Input pipeline performance
prepare_inputwith vectorized indexed assignment for 2D and 3D cases.Test/config alignment
pyproject.tomlsopytest.iniremains the single source of truth.Checklist
All contributions
python -m pytest tests/orpytest tests/)sys.path.appendhacks — imports usefrom odyssnet import ...directlyLibrary changes (
odyssnet/)tests/New/modified example scripts (
examples/)set_seed(42)is called as the first line ofmain()examples/for core validations,examples/advanced/for complex tasks)OdyssNetTrainer(not a manual training loop)TrainingHistoryto record metrics and callshistory.plot()at the end__file__, not hardcoded