refactor model-specific registry fields into the models subdir instead - #2821
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors “model-specific” WebUI/CLI configuration field definitions out of the monolithic field-registry section modules and into per-model modules under simpletuner/helpers/models/field_registry, then adds a discovery hook so these model-owned registries are automatically registered when FieldRegistry is instantiated.
Changes:
- Added a package discovery mechanism (
register_model_field_registries) that imports and registers all model registry modules insimpletuner/helpers/models/field_registry. - Moved multiple model-specific
ConfigFielddefinitions out of core section registrars (validation/training/model/lora/loss/logging_fields/advanced) into dedicated model registry modules. - Added a unit test ensuring model registry modules are discovered and that context-based filtering still behaves correctly.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_model_field_registry.py | Adds unit coverage for model registry discovery and context filtering behavior. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/init.py | Hooks model registry auto-registration into the standard register_all_sections flow. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/validation.py | Removes model-specific validation fields that are now defined in per-model registries. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/training.py | Removes ACE-Step and Wan model-specific training fields now owned by model registries. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/model.py | Removes model-specific model-tab fields (e.g., Wan/Flux) now owned by model registries. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/loss.py | Removes HiDream model-specific loss fields now owned by the HiDream registry module. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/lora.py | Removes Flux/ACE-Step LoRA target fields now owned by their model registry modules. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/logging_fields.py | Removes several model-specific “model tab” fields now owned by model registry modules. |
| simpletuner/simpletuner_sdk/server/services/field_registry/sections/advanced.py | Removes Flux/SD3-related fields now owned by model registry modules. |
| simpletuner/helpers/models/field_registry/init.py | Implements pkgutil-based discovery/import and calls each module’s register_fields. |
| simpletuner/helpers/models/field_registry/ace_step.py | Adds ACE-Step-owned fields (lyrics/audio validation, lyrics-embedder training, ACE-Step LoRA targets). |
| simpletuner/helpers/models/field_registry/deepfloyd.py | Adds DeepFloyd-owned validation pipeline/stage override fields. |
| simpletuner/helpers/models/field_registry/flux.py | Adds Flux-owned fields (validation CFG options, LoRA targets, training guidance, fused QKV, text encoder layer overrides). |
| simpletuner/helpers/models/field_registry/wan.py | Adds Wan-owned fields (FF chunking, time embedding toggle, paired-stage validation toggle). |
| simpletuner/helpers/models/field_registry/sdxl.py | Adds SDXL-owned fields (refiner range toggle, validation pipeline mode and stage model overrides). |
| simpletuner/helpers/models/field_registry/sd3.py | Adds SD3-owned unconditional behavior fields. |
| simpletuner/helpers/models/field_registry/sana.py | Adds Sana-owned complex instruction field. |
| simpletuner/helpers/models/field_registry/ltx.py | Adds LTX-owned training-mode/probability/noise-related fields. |
| simpletuner/helpers/models/field_registry/ltxvideo2.py | Adds LTX-2-owned intrinsic conditioning and validation conditioning fields. |
| simpletuner/helpers/models/field_registry/krea2.py | Adds Krea2-owned reference latents toggle field. |
| simpletuner/helpers/models/field_registry/ideogram.py | Adds Ideogram-owned prompt/validation/schedule-related fields. |
| simpletuner/helpers/models/field_registry/hidream.py | Adds HiDream-owned load balancing loss fields. |
💡 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.
This pull request introduces model-specific field registry modules for the
ace_step,deepfloyd, andfluxmodel families, enabling dynamic registration of configuration fields for each model type. The main addition is a modular discovery mechanism for model field registries, along with comprehensive field definitions for each supported model family.Field Registry Discovery
simpletuner/helpers/models/field_registry/__init__.py: Implements a discovery and registration function (register_model_field_registries) that automatically imports and registers fields from all modules in thefield_registrypackage, enabling modular extension for new model types.ACE-Step Model Fields
simpletuner/helpers/models/field_registry/ace_step.py: Adds a registry for ACE-Step-specific fields, including lyrics validation, audio duration, lyrics embedder training and optimization options, learning rate scheduler, and LoRA target layer selection. These fields include advanced and experimental options, with validation and dynamic dependencies.DeepFloyd Model Fields
simpletuner/helpers/models/field_registry/deepfloyd.py: Introduces DeepFloyd-specific validation fields, covering pipeline mode selection, model repository overrides for each stage, upscaler options, per-stage inference steps and guidance, and noise level configuration. All fields are grouped under advanced validation options and include documentation links.Flux Model Fields
simpletuner/helpers/models/field_registry/flux.py: Provides Flux and Flux2-specific fields, such as real CFG values, CFG skipping, LoRA target selection, guidance mode and values, experimental training options, QKV projection fusion, and custom text encoder layer overrides. Advanced and experimental fields are included with appropriate validation and dependencies.