# Programmatically running Sweeps using Hydra

**URL:** <https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960>\
**Category:** W&B Help\
**Created:** [February 27, 2023, 1:21pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960 "2023-02-27T13:21:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![k4i97](https://avatars.discourse-cdn.com/v4/letter/k/e9c0ed/32.png) [@k4i97](https://community.wandb.ai/u/k4i97)\
**Post date:** [February 27, 2023, 1:21pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960/1 "2023-02-27T13:21:48Z")

</div>

Hello,

I want to write a python script which runs multiple sweeps after another. My train.py works with hydra, which I want to keep that way. Until now I was able to run sweeps using the command line and a config.yaml file which has at the end:  
command:

- ${env}
- python
- ${program}
- ${args\_no\_hyphens}  
Is there a way to bring this into the dictionary used in the function wandb.sweep in python?

Thanks in advance and best regards

---

<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:** [March 2, 2023, 5:23pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960/2 "2023-03-02T17:23:58Z")

</div>

Hi Kai,

Unfortunately, there is no way of bringing that to a dictionary.

The YAML-based sweep starts a whole process and a dictionary-based sweep starts a function.

So, there is no “command” parameter for dictionary-based sweeps, since you call `wandb.agent` and pass a function to it.

Warmly,  
Artsiom

---

<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:** [March 8, 2023, 4:47pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960/3 "2023-03-08T16:47:40Z")

</div>

Hi Kai,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best,  
Weights & Biases

---

<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:** [March 14, 2023, 2:38pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960/4 "2023-03-14T14:38:49Z")

</div>

Hi Kai,  
Since we have not heard back from you, we are going to close this request. If you would like to re-open the conversation, please let us know!

Best,  
Artsiom

---

<div class="post-metadata">

**Author:** ![k4i97](https://avatars.discourse-cdn.com/v4/letter/k/e9c0ed/32.png) [@k4i97](https://community.wandb.ai/u/k4i97)\
**Post date:** [March 20, 2023, 8:29pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960/5 "2023-03-20T20:29:28Z")

</div>

Hi Artisom,  
sorry, it seems that I didn’t get a notification for your answer, thank you very much. I think I found a workaround for my problem, by adding this line to my dictionary it worked:

“command”: [  
“${env}”,  
‘python’,  
‘${program}’,  
‘${args\_no\_hyphens}’  
],

Best regards and sorry for the late reply

Kai

---

<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:** [May 19, 2023, 8:29pm UTC](https://community.wandb.ai/t/programmatically-running-sweeps-using-hydra/3960/6 "2023-05-19T20:29:49Z")

</div>

Closed on May 19, 2023, 8:29pm UTC

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