Skip to content

Adding support grid search like hydra for making it easier for user to run experiments #24

Closed

Description

@aaishwarymishra

currently we are using the omegaconf, for use case like training a single model by manually editing the parameter values before each run is fine.

But we want to do some serious experimenting , we literally need to write a separate script for it. Omega does not support it natively, but hydra does.

A simple example will look like this:

lr: 0.01
layers: 32
epochs: 10

hydra:
  mode: MULTIRUN  
  sweeper:
    params:
      lr: 0.1, 0.01, 0.001
      layers: 32, 64, 128

we can replace omegaconf with hydra if we want without changing much how current code works, but we do need to add the hydra decorator in our main function.

Activity

  1. aaishwarymishra commented on May 26, 2026

    @aaishwarymishra
    MemberAuthor
  2. added
    enhancement
    on May 26, 2026
  3. vfdev-5 commented on May 27, 2026

    @vfdev-5
    Member

    @aaishwarymishra can you provide a simple small runnable code + config to see in details how hydra works. You should also discuss pros/cons of omegaconf by hydra replacement

  4. aaishwarymishra commented on May 27, 2026

    @aaishwarymishra
    MemberAuthor
    @hydra.main(version_base=None, config_path=".",config_name="config")
    def main(cfg: DictConfig) -> None:
        config_dict = OmegaConf.to_container(cfg, resolve=True)
        config =ProjectConfig.model_validate(config_dict)
        trainer = PreTrainer(config)
        trainer.run()

    so before we were using argpase and manually parsing the yaml but with the hydra decorator it does it automatically.

    pros:

    • multi run for example we can set parameters both in cli and yaml python main.py -m optimizer.lr=1e-3,1e-4 dataset.dataloader.batch_size=32,64 it's the main purpose of using hydra, for trainite as its hard to do ourself.
    • Optuna integration

    cons:

    • @hydra.main
    • the multi run values will be validated at runtime one combination at time from pydantic not all together.
    • Hydra also changes the working directory to output dir, so relative paths will break if used, we have explicitly add parameter in yaml or cli to disable it, or refactor code. I think we can disable it by default during code gen.

    @vfdev-5

  5. Arun-sunny23 commented on Sep 13, 2026

    @Arun-sunny23
    Contributor

    Hi! I noticed this discussion — is this still open for someone to help with, @aaishwarymishra? I'd like to contribute if so. I could start by putting together the runnable example @vfdev-5 asked for, based on what's already been discussed here.

  6. aaishwarymishra commented on Sep 13, 2026

    @aaishwarymishra
    MemberAuthor

    We are not sure how this could be implemented but you can give it a try :)
    we dont want to use hydara yet as it could be hard for people to learn. But the idea is same to let users use the grid search for experimentation.

  7. Arun-sunny23 commented on Sep 13, 2026

    @Arun-sunny23
    Contributor

    Got it, thanks! I'll start working on a simple grid-search implementation without Hydra.

  8. tamrind69 commented on Nov 19, 2026

    @tamrind69
    Contributor

    implemented in #205
    can be closed
    @aaishwarymishra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions