Phase 5: API code quality - ModelInspector, trainer mixins, registry modernization#4091
Open
w4nderlust wants to merge 6 commits intodata-pipeline-hyperopt-modernizationfrom
Open
Phase 5: API code quality - ModelInspector, trainer mixins, registry modernization#4091w4nderlust wants to merge 6 commits intodata-pipeline-hyperopt-modernizationfrom
w4nderlust wants to merge 6 commits intodata-pipeline-hyperopt-modernizationfrom
Conversation
f82345c to
106a30b
Compare
ModelInspector: extracts weight collection, model summary, and feature importance estimation from LudwigModel god object. Trainer mixins: CheckpointMixin, EarlyStoppingMixin, MetricsMixin, BatchSizeTuningMixin, ProfilingMixin for composable training behavior. Registry: add unregister(), get_default(), list_registered() methods and improved docstrings for type-safe, testable registries.
for more information, see https://pre-commit.ci
- ludwig inspect: CLI command to view model summary, weights, and approximate feature importance from a saved model - Tests for all 5 trainer mixins (checkpoint, early stopping, metrics, batch size tuning, profiling) - Tests for training report generation and model card generation
Remove __iter__ from TrainingStats (was never used for unpacking). Add deprecation warnings to __iter__/__getitem__ on TrainingResults and PreprocessedDataset -- existing code keeps working but emits DeprecationWarning. Internal code updated to use attribute access.
Trainer now inherits from CheckpointMixin, EarlyStoppingMixin, MetricsMixin, and ProfilingMixin. This makes the mixin utility methods (should_checkpoint, should_early_stop, format_metrics, start_timer/stop_timer) available on the Trainer instance for gradual refactoring of inline logic.
106a30b to
7e4467a
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.
Summary
Phase 5 of the Ludwig modernization: break up god objects and improve code quality.
1. ModelInspector
Extracts model introspection from the 2400-line LudwigModel into a focused class:
Provides: weight collection, model summary (param counts, layer types, model size), and feature importance estimation.
2. Trainer Mixins
Composable mixins for cross-cutting training concerns:
3. Registry Modernization
Added to the existing Registry class:
unregister(name): remove registered items (useful for testing)get_default(): get the default-registered itemlist_registered(): list all names excluding default key aliasesTest plan