How do I make a generated project sweep work with a jupyter notebook?

I really like that in my project the config was automatically generated. So I would like to use that for running from jupyter notebook. All the examples I have seen are that you make the config file within the jupyter notebook and then also make the sweep in the same cell as your function. Is there anyway to use the auto-generated project config for my jupyter notebook in colab.

I tried something like this, but it did not work:

import sweep #trying to import sweep.yaml file

sweep_id=wandb.sweep(sweep)

count = 1 # number of runs to execute

wandb.agent(sweep_id, function=train_model, count=count)

Being able to plug the sweep_id from the projects page to the jupyter notebook would be ideal. Is there a way to do that

Hi @sdeleon ,

I’ll be glad to assist you with this. This Sweep Configuration document is a great resource how to structure/configure your sweeps, and our Sweep Quickstart goes into further details

YAML files are best for sweeps from the command line and can be created using the following command, wandb sweep <file name>.yaml. If you intend on importing a confg.yaml file to your jupyter notebook, then first parse the config.yaml to a dictionary, using for example, PyYAML, prior to use with wandb.sweep()

pip install pyyaml
import yaml
with open('config.yaml', 'r') as stream:
        sweep_config_dic=yaml.safe_load(stream)

Please let me know if you have additional questions.

Regards,

Mohammad

1 Like

Hi @sdeleon ,

I am following up on your request to setting up sweeps in a Jupyter Notebook environment. Please let me know if you have any questions/comment about my initial response.

Hi @sdeleon , 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!

Regards,

Mohammad