Skip to content

[WIP] migration to structured configuration classes#3172

Closed
arashsm79 wants to merge 2 commits intoDeepLabCut:mainfrom
arashsm79:arash/typed_config
Closed

[WIP] migration to structured configuration classes#3172
arashsm79 wants to merge 2 commits intoDeepLabCut:mainfrom
arashsm79:arash/typed_config

Conversation

@arashsm79
Copy link
Contributor

@arashsm79 arashsm79 commented Jan 9, 2026

Edit (by @deruyter92): this PR was split into several sub-PRs to facilitate a smooth transition. An overview is kept in #3193.

Summary

  • Introduce new configuration classes for inference, logging, model, pose, project, runner, and training settings.
  • Refactore data loading mechanisms to utilize new configuration structures.
  • Move the multithreading and compilation options in inference configuration to the config module.
  • Typed configuration for logging.
  • Update dataset loaders to accept model configurations directly or via file paths.

Why Typed & Structured Configuration (OmegaConf + Pydantic)

  • Strong guarantees for correctness

    • Runtime type safety ensures invalid configs fail fast with clear errors instead of silently producing incorrect training runs.
    • Schema-validated configs dramatically reduce debugging time for users and maintainers.
  • Static typing improves developer velocity

    • IDE autocomplete and inline documentation make configs discoverable and self-documenting.
    • Refactors become safer: config changes are more likely to be caught at development time.
  • Hierarchical, composable configuration

    • Natural representation of DeepLabCut’s nested project/model/training settings.
    • Easy composition and merging from multiple sources (base config, model presets, experiment overrides).
  • Cleaner overrides and defaults.

  • Structured configs make it easier to define parameter ranges for tuning and automation.

  • Config schemas can be versioned and evolve safely over time while preserving backward compatibility.

  • Full, validated configuration can be saved alongside results, which improves reproducibility and transparency.

  • Builds on well-maintained, widely adopted libraries (OmegaConf, Pydantic).

Resources for knowing more about structured configs:

Future Work

  • Currently default model definitions are still stored as yaml files in the package. Moving to LazyConfig as in Detectron 2 would improve things significantly.

More things that could be done ( @deruyter92 ):

  • I think we need to make sure that everytime a model is used, all the changes to the project's config.yaml are reflected in the model's configuration under metadata as well.
  • There might be a better way to handle things in deeplabcut/pose_estimation_pytorch/data/base.py.

- Introduced new configuration classes for inference, logging, model, pose, project, runner, and training settings.
- Refactored data loading mechanisms to utilize new configuration structures.
- Moved the multithreading and compilation options in inference configuration to the config module.
- Typed configuration for logging.
- Updated dataset loaders to accept model configurations directly or via file paths.
@deruyter92 deruyter92 self-requested a review January 9, 2026 16:02
@deruyter92 deruyter92 changed the title feat: add structured configuration classes [WIP] migration to structured configuration classes Jan 29, 2026
@deruyter92
Copy link
Collaborator

Great PR! We are working on it. Closing this one in favor of several replacement PRs, e.g. #3190, #3191. See issue #3193 for an overview of the WIP.

@deruyter92 deruyter92 closed this Jan 30, 2026
@deruyter92 deruyter92 added this to the Structured configs milestone Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments