Wandb Sweep running bash scripts


I’d like to use Wandb sweep but running different parameter settings with bash. Is it possible?
Or I have to have a python file as entry point to parse the parameters and execute bash from python.


Hi @kevindong,

This should be possible, I was able to set up a sweep config which can run a bash shell:

program: main.sh
method: random
  name: validation_loss
  goal: minimize
    min: 0.0001
    max: 0.1
    values: ["adam", "sgd"]
  - ${env}
  - bash
  - ${program}
  - ${args}

However, there is no equivalent of wandb.log for bash, so there is no way to communicate any data back to W&B.


Thanks Ramit. your code above works.

However, if I use bash script as the ${program}, it seems the wandb server can’t know if the run is successful or not. All runs started in such a way will end up as “Crashed” state in the sweep table on the webapp

How does Wandb determine the status code?

Hey Kevin,

W&B will not be able to send off a status code if you are operating directly through bash - the exit code is communicated to our servers through wandb.finish, which is written for python.

You might want to set up an entrypoint through python and run your bash script through there if you are looking to interact with W&B more.

Hi Kevin,

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.

Weights & Biases

Hi Kevin, 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.