Skip to content

Add missing wandb Hydra config group to minimal-hydra-example#635

Open
johndmulhausen wants to merge 1 commit into
mainfrom
fix/issue-482-hydra-wandb-config
Open

Add missing wandb Hydra config group to minimal-hydra-example#635
johndmulhausen wants to merge 1 commit into
mainfrom
fix/issue-482-hydra-wandb-config

Conversation

@johndmulhausen

Copy link
Copy Markdown
Contributor

Problem

Running the minimal Hydra example fails immediately at config composition:

hydra.errors.MissingConfigException: In 'defaults': Could not find 'wandb/default'

examples/minimal-hydra-example/configs/defaults.yaml lists - wandb: default in its Hydra defaults, but the configs/wandb/ directory does not exist in the repo.

Root cause

The repo-root .gitignore contains a bare wandb pattern (line 3, intended for wandb run-output directories), which also matches configs/wandb/git check-ignore -v confirms it. The config group was silently swallowed and never committed.

Fix

  1. examples/minimal-hydra-example/configs/wandb/default.yaml (new): defines the config group with a top-level setup: mapping, matching how it is consumed and documented:
    • main.py uses exactly one thing from this group: wandb.init(**cfg.wandb.setup), so the group must be a mapping of valid wandb.init kwargs under setup:.
    • The README states the project is called example-hydra and documents overriding entity with wandb.setup.entity=<entity_name> (same override path used for wandb_sweep.yaml). Declaring entity: null is load-bearing: Hydra struct mode rejects overrides of keys that do not exist, so without it the documented override would fail. entity=None is wandb.init's default (use your default entity).
    • File style matches the sibling group configs (leading --- document marker, no # @package directive, same as configs/model/default.yaml and configs/optimizer/*.yaml).
  2. .gitignore: adds !examples/minimal-hydra-example/configs/wandb/ immediately after the wandb pattern so the config group cannot be silently re-lost (for example, a future configs/wandb/offline.yaml would otherwise be skipped by git add with no warning).

Verification

Compose test (hydra-core 1.3.4 / omegaconf 2.3.1):

from hydra import compose, initialize_config_dir
import os
cfg_dir = os.path.abspath("examples/minimal-hydra-example/configs")
with initialize_config_dir(version_base=None, config_dir=cfg_dir):
    cfg = compose(config_name="defaults")
    assert cfg.wandb.setup.project == "example-hydra"
    cfg2 = compose(config_name="defaults", overrides=["wandb.setup.entity=test-entity"])
    assert cfg2.wandb.setup.entity == "test-entity"
  • Before this change: fails with MissingConfigException: In 'defaults': Could not find 'wandb/default' (the exact error from [Bug]: minimal-hydra-example is missing wandb config #482).
  • After: both composes pass; composed group is {'setup': {'project': 'example-hydra', 'entity': None}}.
  • Sanity check: wandb.init(project="example-hydra", entity=None, mode="offline") runs and finishes cleanly (wandb 0.26.1).

Fixes #482

🤖 Generated with Claude Code

configs/defaults.yaml lists the `wandb: default` Hydra config group,
but configs/wandb/ was never committed: the repo-root .gitignore's
bare `wandb` pattern (meant for run-output directories) also matched
it. Composition failed with:

    In 'defaults': Could not find 'wandb/default'

Add configs/wandb/default.yaml with the `setup:` mapping that main.py
unpacks into wandb.init(**cfg.wandb.setup), plus a .gitignore negation
so the config group cannot be silently re-lost.

Fixes #482

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 17, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the minimal Hydra example failing during config composition by adding the missing wandb config group and preventing it from being ignored by git.

Changes:

  • Add examples/minimal-hydra-example/configs/wandb/default.yaml so - wandb: default composes successfully.
  • Update repo-root .gitignore to explicitly allow committing the examples/minimal-hydra-example/configs/wandb/ directory despite the global wandb ignore rule.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
examples/minimal-hydra-example/configs/wandb/default.yaml Adds the missing Hydra config group providing setup kwargs consumed by wandb.init(**cfg.wandb.setup).
.gitignore Prevents the configs/wandb/ group from being ignored by the global wandb pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@johndmulhausen
johndmulhausen marked this pull request as ready for review July 21, 2026 21:33
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.

[Bug]: minimal-hydra-example is missing wandb config

2 participants