# Nested Sweep Configuration

**URL:** <https://community.wandb.ai/t/nested-sweep-configuration/3369>\
**Category:** W&B Help\
**Tags:** sweeps, wandb\
**Created:** [November 2, 2022, 5:13pm UTC](https://community.wandb.ai/t/nested-sweep-configuration/3369 "2022-11-02T17:13:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjvolk3](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mjvolk3](https://community.wandb.ai/u/mjvolk3)\
**Post date:** [November 2, 2022, 5:13pm UTC](https://community.wandb.ai/t/nested-sweep-configuration/3369/1 "2022-11-02T17:13:09Z")

</div>

I have been attempting to use [Hydra configuration](https://docs.wandb.ai/guides/integrations/other/hydra) with a wandb sweeps. I have nested hierarchy of configuration. When defining the parameters I want to sweep over I would like to something like the following:

```auto
optimizer:
    parameters:
        learning_rate:
            values: [0.01, 0.001]
        momentum:
            value: 0.9

```

Source: [Sweep Configuration](https://docs.wandb.ai/guides/sweeps/define-sweep-configuration)  
When I attempt this, I get a `CommError` with a message that `sweep config must have a parameters section `. I do not get this error if `parameters` is at the top level of the hierarchy, but then the configs are not read in properly. If I were to modify the above example to the following (only swapped `parameters` with `optimizer`):

```auto
parameters:
    optimizer:
        learning_rate:
            values: [0.01, 0.001]
        momentum:
            value: 0.9

```

I would get a `CommError` with message `Invalid sweep config: invalid hyperparameter configuration: optimizer`. I would like to keep the hierarchical structure of the YAML base config but add `parameters` which will indicate which parameters to sweep over. Any recommendation? or resources? A code example using a nested `sweep.yaml` would be ideal.

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [November 3, 2022, 5:18am UTC](https://community.wandb.ai/t/nested-sweep-configuration/3369/2 "2022-11-03T05:18:55Z")

</div>

Hi @mjvolk3,

This is currently not available with our sweep configurations. We have a more customizable nested sweep config as you describe planned as a feature for the future, I can go ahead and increase the priority on it for you.

---

<div class="post-metadata">

**Author:** ![mjvolk3](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mjvolk3](https://community.wandb.ai/u/mjvolk3)\
**Post date:** [November 6, 2022, 4:10pm UTC](https://community.wandb.ai/t/nested-sweep-configuration/3369/3 "2022-11-06T16:10:26Z")

</div>

It looks like this is supported. It works if you put `parameters:` between every level. With the previous example it looks like the following:

```auto
parameters:
    optimizer:
        parameters:
            learning_rate:
                values: [0.01, 0.001]
            momentum:
                value: 0.9

```

The original source I referenced (wandb docs) must be indicating that the block below works if it is put under `parameters:`

```auto
optimizer:
    parameters:
        learning_rate:
            values: [0.01, 0.001]
        momentum:
            value: 0.9

```

I have tested this pattern with deeper hierarchies and it works.

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [November 16, 2022, 12:49pm UTC](https://community.wandb.ai/t/nested-sweep-configuration/3369/4 "2022-11-16T12:49:12Z")

</div>

Hey @mjvolk3,

You are right - I confirmed and this has been implemented recently, just skipped my radar. Is there anything else I can assist with here?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [January 15, 2023, 12:49pm UTC](https://community.wandb.ai/t/nested-sweep-configuration/3369/5 "2023-01-15T12:49:26Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
