Sweep - starting with a small project

Hi there,
I’m new to W&B and try to use sweep to find best parameters for MNIST with tf2.

First, I ran sweep agent and I’ve got this issue that I don’t understand where it comes from…
AttributeError: module ‘wandb’ has no attribute ‘init’
It doesn’t appear when I 'm not using any agent.

Second it’s not clear to me if it’s mandatory to put the hyperparameters as command line arguments. I’m using a json file to fill the default values. I thought I would use this kind of file to configure the sweep.

Where exactly do we have to run the agent? My script train.py is in a folder, source code in another, and my experiment in a third one. I would have like to put the sweep.yaml with my experiments. Is there a way to put the script and the yaml file in a different folder?

Thanks for your help

Hi @xllcrn,

I’m sorry you are facing this issue. Can you test where wandb is getting imported from? You should be able to do this by running

print(wandb.__path__)

Chances are, it is importing the wandb directory generated instead of the actual library. Since this is happening with agent and not normal runs, one possibility of why this is happening is if you are using wandb agent instead of wandb.agent() and the interpreter used by wandb agent might not have wandb installed, causing the generated folder to get imported as a module.

I would recommend trying one of the following solutions:

  1. Change the ${interpreter} in your config.yaml to a Python interpreter which has wandb installed. Check out our docs on Sweep Configuration here.
  2. Alternatively, try using wandb.agent() instead of wandb agent.

Please let me know if I can assist you any further.

Thanks,
Ramit

Hi @xllcrn ,

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.

Thanks,
Weights and Biases Support

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

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