# Nested sweep configuration for python script

**URL:** <https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742>\
**Category:** W&B Help\
**Tags:** sweeps\
**Created:** [January 18, 2024, 4:06pm UTC](https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742 "2024-01-18T16:06:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hlee2745](https://avatars.discourse-cdn.com/v4/letter/h/d2c977/32.png) [@hlee2745](https://community.wandb.ai/u/hlee2745)\
**Post date:** [January 18, 2024, 4:06pm UTC](https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742/1 "2024-01-18T16:06:18Z")

</div>

I have a nested structure for my sweep configuration. Referencing [wandb doc](https://docs.wandb.ai/guides/sweeps/define-sweep-configuration#nested-parameters) and [nested sweep configuration](https://community.wandb.ai/t/nested-sweep-configuration/3369), I created my sweep configuration in the following structure:

```auto
sweep_config = {
    "method": "random",
    "metric": {"name": "val.loss", "goal": "minimize"},
    "parameters": {
        "batch_size": {"values": [16, 32, 64]},
        "lr": {"distribution": "inv_log_uniform_values", "min": 0.001, "max": 0.1},
        "model_params": {
            "parameters": {
                "out_features": {"values":[100, 125, 150, 175, 200]},
                "p": {"values":[0, 0.1, 0.2, 0.3, 0.4, 0.5]}
            }
        }
    }
}

```

However, running sweep with this configuration gives me an error like the following: “Invalid sweep config: invalid hyperparameter configuration: model\_params”. I would like to keep this nested structure since it is convenient, but how can I change the configuration to make the sweep work?

---

<div class="post-metadata">

**Author:** ![artsiom](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/artsiom/32/1001_2.png) [@artsiom](https://community.wandb.ai/u/artsiom)\
**Post date:** [January 23, 2024, 3:53pm UTC](https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742/2 "2024-01-23T15:53:55Z")

</div>

Hi @hlee2745!

Thank you for writing in!

Out of curiosity, could you please see if you will be getting the same error for this sweep config:

```auto
sweep_config = {
    "method": "random",
    "metric": {"name": "val.loss", "goal": "minimize"},
    "parameters": {
        "batch_size": {"values": [16, 32, 64]},
        "lr": {"distribution": "log_uniform", "min": 0.001, "max": 0.1},
        "out_features": {"values": [100, 125, 150, 175, 200]},
        "p": {"values": [0, 0.1, 0.2, 0.3, 0.4, 0.5]}
    }
}

```

Although we do support nested sweeps, I wonder if the example you have brought above is not something we can do.

---

<div class="post-metadata">

**Author:** ![artsiom](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/artsiom/32/1001_2.png) [@artsiom](https://community.wandb.ai/u/artsiom)\
**Post date:** [January 25, 2024, 5:06pm UTC](https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742/3 "2024-01-25T17:06:35Z")

</div>

Hi there, I wanted to follow up on this request. Please let us know if we can be of further assistance or if your issue has been resolved.

---

<div class="post-metadata">

**Author:** ![artsiom](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/artsiom/32/1001_2.png) [@artsiom](https://community.wandb.ai/u/artsiom)\
**Post date:** [January 29, 2024, 7:08pm UTC](https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742/4 "2024-01-29T19:08:26Z")

</div>

Hi, since we have not heard back from you, we are going to close this request. If you would like to reopen the conversation, please let us know! Unfortunately, at the moment, we do not receive notifications if a thread reopens on Discourse. So, please feel free to create a new ticket regarding your concern if you’d like to continue the conversation.

---

<div class="post-metadata">

**Author:** ![kedarnathvasudevan](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@kedarnathvasudevan](https://community.wandb.ai/u/kedarnathvasudevan)\
**Post date:** [February 5, 2024, 8:51am UTC](https://community.wandb.ai/t/nested-sweep-configuration-for-python-script/5742/5 "2024-02-05T08:51:10Z")

</div>

is it possible to have multiple Goals in the sweep\_config. For Example, maximize one variable and minimize some other variable ? is this possible?
