Skip to content

Conversation

@felipemello1
Copy link
Contributor

@felipemello1 felipemello1 commented Oct 30, 2025

This PR attempts to showcase the different styles we could use for our config system. A push here is if we can leave the .yaml and use .py instead, under the reasoning that "config is code".

Python can enable a) better type safety, b) import directly instead of using strings, and c) more flexibility for the user to define custom code within the config.

On the other hand, yaml can be easier to read and hydra provides some nice freebies.

Must have:

  • Lazy instantiation: Currently we don't have any way to instantiate a function through configs, e.g. 'loss: my_loss_fn'.
  • Handle complex patterns, e.g. nesting

Nice to have:

  • Composition: Our code is naturally fragmented (generator, rewards, etc). Touching one config without touching the others is a relevant feature.
  • Ability to code in the config, e.g. if statements, sum values, check conditions, etc.
  • CLI overrides

Proposed options:

  1. OmegaConfg / Hydra
  2. Fiddle (cfg option by google)
  3. Factory + dataclasses
  4. Plain python with partials
  5. Plain python with dictionary
    TODO: toml

I would like to hear what others think about the options, if we should stick with yaml and fully explore hydra/omegaconf or change to .py system.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 30, 2025
This PR showcases different styles for our config system, exploring
the "config is code" philosophy.

Implements 5 approaches:
1. OmegaConf/Hydra (YAML-based)
2. Fiddle (Google's config library)
3. Factory + dataclasses
4. Plain Python with functools.partial
5. Plain Python with dictionaries

Each approach demonstrates handling of:
- Lazy instantiation
- Nested component instantiation
- Partial application for runtime args
- Config composition and overrides
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant