Optimiser presets available outside of training configuration wizard#2723
Merged
Conversation
added 2 commits
May 20, 2026 09:45
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors optimizer preset handling into a shared frontend module and exposes the same preset selector UI beyond the training configuration wizard (including Easy Mode and a standalone modal), addressing #2528 by making presets easier to access and consistent across screens.
Changes:
- Centralize optimizer preset definitions + helper logic in a shared JS module and update the training wizard to consume it.
- Add a reusable Jinja macro for rendering preset cards, used in the wizard, Easy Mode training UI, and a new “Optimizer Presets” modal.
- Add new CSS styling for the preset card UI and extend tests to cover the new templates + shared preset behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_template_rendering.py | Adds assertions that optimizer preset selector UI renders in training tab, training wizard, and the new modal. |
| tests/js/training_wizard.test.js | Verifies wizard consumes shared optimizer preset module and applies presets correctly. |
| tests/js/optimizer_presets.test.js | New unit tests for shared preset module helpers (keys, values, matching, optimizer resolution). |
| tests/js/ez_mode_events.test.js | Adds static analysis assertions for EZ Mode sync fallback logic. |
| simpletuner/templates/trainer_htmx.html | Includes the new optimizer presets modal partial in the main trainer page. |
| simpletuner/templates/partials/training_wizard_modal.html | Replaces inline preset card markup with the shared preset selector macro. |
| simpletuner/templates/partials/optimizer_presets_modal.html | New modal template to apply wizard presets outside the wizard flow. |
| simpletuner/templates/partials/optimizer_preset_selector.html | New macro providing a shared preset card selector UI. |
| simpletuner/templates/form_tab.html | Integrates the shared selector into Training Easy Mode and wires it to shared preset logic. |
| simpletuner/templates/base_htmx.html | Loads shared optimizer preset JS + CSS assets globally. |
| simpletuner/static/js/training-wizard.js | Replaces hardcoded preset definitions/formatting with shared optimizer preset module calls. |
| simpletuner/static/js/optimizer-presets.js | New shared preset module (definitions + helpers) plus modal + button-injection UI wiring. |
| simpletuner/static/css/optimizer-presets.css | New styling for preset cards and the optimizer preset modal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #2528
This pull request introduces a major refactor to how optimizer presets are managed and selected in the training wizard and related UI. The main changes include moving all optimizer preset logic into a shared JavaScript module, updating both the training wizard and "EZ mode" forms to use this shared logic, and adding new styles and UI for selecting optimizer presets. These changes improve maintainability, consistency, and user experience across the application.
Refactor and Centralization of Optimizer Preset Logic:
optimizer-presets.js), which is now loaded before the training wizard and form components. Both the training wizard and "EZ mode" forms now use this centralized logic to fetch, apply, and display optimizer presets, replacing duplicated or hardcoded preset definitions. [1] [2] [3]Training Wizard Integration:
training-wizard.js) has been refactored to use the shared preset module for all preset-related operations, including applying presets, resolving optimizer selections, formatting learning rates, and rendering preset cards. Old hardcoded preset definitions and logic have been removed in favor of calls to the shared module. [1] [2] [3] [4] [5]"EZ Mode" Form Integration:
form_tab.html) has been updated so that the "EZ mode" optimizer section also uses the shared preset logic. This includes syncing the selected preset with form fields, applying presets, and updating the UI accordingly. Several new methods and state variables have been added to support this integration. [1] [2] [3] [4] [5]UI and Styling Enhancements:
optimizer-presets.css) has been added and loaded into the base template to provide improved visual styling for optimizer preset cards and modal dialogs, including light and dark theme support and responsive layouts. [1] [2]Template and Import Adjustments:
These changes collectively provide a more maintainable, consistent, and user-friendly experience for selecting optimizer presets throughout the application.