question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WandB client error when tuple used in sweeps config

See original GitHub issue

Python version: 3.7 Wandb versions tested: 0.10.6 to 0.10.10 OS: Linux

Summary: Wandb sweep agents will run once and then error out on all subsequent runs. The observed error is the anaconda 400 / graphql 500 error that I’ve seen here frequently, but the nested error is the common numpy error that goes something like “boolean from array makes no sense, use np.all or np.any”. It was pretty uninformative, but I think I’ve tracked down the issue.

Use case: I have a couple hyperparameters that are categorical but dependent on one another. Example: param A could be values X, Y, Z and param B could be values L, J, K, but only certain combos make sense, e.g., (X, L), (X, J), (Y, J), (Z, K). Rather having those listed as separate params and wandb passing combos that don’t make sense, I configured those params to be tuples. Note that the current docs say categorical values can have distribution defined by “values: [(value), (value)…]”, but does not suggest that “value” cannot be a tuple.

Sample configuration dictionary:

        "parameters": {
            ...
            "linked_hypers": {"distribution": "categorical", "values": [(0, 0), (8, 8), (8, 16), (16, 8), (16, 16)]},
            ...
        },

Solution: I ended up encoding these tuples as strs in the config, e.g., “8,8”, then splitting and casting to the actual parameter values in my code. The errors stopped. However, it’d be nice to either have support for tuples, have informative error messages when this happens, or have more info in the docs, but I’m guessing the quickest/easiest solution on your end is just to have more rigorous input checks when sweep configs are submitted.

(Apologies for not grabbing the actual stacktrace)

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vanpeltcommented, Nov 30, 2020

@nsfabina we’re going to support tuples in the next release of our client library due out later this week. We’ll update this ticket once it’s released.

1reaction
farizrahman4ucommented, Nov 19, 2020

Got a script to reproduce? Following works for me:

import wandb

sweep_config = {
  "name": "My Sweep",
  "method": "grid",
  "parameters": {
        "param1": {
            "values": [1, 2, 3]
        },
        "param2":{
            "distribution": "categorical",
            "values": [(0, 0), (8, 8), (8, 16), (16, 8), (16, 16)]
        }
    }
}

sweep_id = wandb.sweep(sweep_config)

def train():
    run = wandb.init()
    print(run.config.param2)
    run.finish()

sweep_id = wandb.sweep(sweep_config)
agent = wandb.agent(sweep_id=sweep_id, function=train)
agent.run()

Read more comments on GitHub >

github_iconTop Results From Across the Web

WandB client error when tuple used in sweeps config #1493
Summary: Wandb sweep agents will run once and then error out on all subsequent runs. The observed error is the anaconda 400 /...
Read more >
Can't associate sweeps with project - W&B Help
Hi, I'm using wandb (great product!!!) and have been able to set up projects, do runs and am now working with sweeps (FANTASTIC!)....
Read more >
parameter sweep python - You.com | The search engine you control.
We have python model defined in “model.py” which has 3 parameters: a, b, c and supports a json config from a file named...
Read more >
IDT Office Hours Logs - HackMD
Potential solution: Take a look at your sweep config to make sure you're not passing two or more flags that set those variables....
Read more >
Changelog — PyTorch Lightning 1.8.5.post0 documentation
Added a more descriptive error message when attempting to fork processes with ... configure PyTorch to use a NVML-based check for torch.cuda.is_available ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found