automl / automl/Mighty

[Enhancement] Parse Hydra Configs into Dataclasses for Typing

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
61
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Unfortunately, hydra and typing is a bit difficult, especially if we don't want to define everything in python dataclasses (which I think we don't so we can hide unnecessary settings from the users). But: untyped it can be difficult to know the correct way of setting arguments as some are obvious (lr is a float), but other not (e.g. network architecture is a list, but could just as well be a dict).

To avoid confusion and also provide better errors, we could specify argument types in dataclasses and parse the config into these dataclasses at the start (lighter version of this: https://blog.helsing.ai/strongly-typed-structured-configuration-in-hydra-8fb43522d224). This would also ensure that we don't handle DictConfigs anymore, which is actually nice.

Proposed structure:

- [ ] Add dataclass for each Mighty class summarizing defaults and argument types (taken from init)
- [ ] Switch to dataclass as init argument for all classes
- [ ] Build hydra parser; this would mean grabbing the correct classes + dataclasses and initializing the arguments while walking through the config
- [ ] Add hydra parser in main and runner
- [ ] Document the process

I'm not 100% set on this, but since the configs are large, this would maybe also make our debugging lives easier in the long run.

Contributor guide

Open the contributing guide

Research direction

Begin with the main and runner entry points, then trace how Hydra configurations are currently passed into Mighty classes. Define the dataclass and parser scope from the listed proposal, including defaults, argument types, and nested configuration handling. Done means classes receive typed dataclasses instead of DictConfigs, the parser is used in main and runner, and the process is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.