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.

sweep: Parameter value written w/ scientific notation gets converted to str?

See original GitHub issue

wandb --version && python --version && uname

  • Weights and Biases version: wandb, version 0.9.1
  • Python version: Python 3.6.9
  • Operating System: Linux (Ubuntu 18.04)

Description

I get the following error when attempting to launch a local sweep:

$ wandb sweep --controller ./sweep.yaml
...
  File ".../lib/python3.6/site-packages/wandb/sweeps/params.py", line
 118, in __init__
    if self.min >= self.max:
TypeError: '>=' not supported between instances of 'str' and 'float'

What I Did

I wrote a sweep.yaml file, following the documentation: https://docs.wandb.com/sweeps/configuration#parameters

I launched as described above, but got the above error. When editing the code, I found that one of the parameters was getting converted to a string.

Reproduction:

( set -eux;
cd $(mktemp -d)

python3 -m venv .
source ./bin/activate

cat > requirements.txt <<'EOF'
wandb==0.10.18
numpy==1.19.0
scipy==1.5.0
EOF

pip install -r ./requirements.txt

cat > ./script.py <<'EOF'
import os
import wandb

def main():
    os.environ["WANDB_MODE"] = "dryrun"
    config = dict(
        lr=1e-4,
    )
    wandb.init(
        config=config,
    )
    print(wandb.config)

if __name__ == "__main__":
    main()
EOF

cat > ./sweep.yaml <<'EOF'
program: ./script.py

controller:
  type: local

method: bayes
metric:
  name: loss/train
  goal: minimize
parameters:
  lr:
    distribution: uniform
    min: 1.e-5  # This is the problem.
    max: 0.001

command:
  - ${env}
  - ${interpreter}
  - ${program}
  - ${args}
EOF

wandb sweep --controller ./sweep.yaml
)

Guesses

Something is randomly trying to stringify things?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
timxzzcommented, Feb 10, 2021

This problem still exists with version: 0.10.18

2reactions
timxzzcommented, Feb 16, 2021

The root cause is indeed as @EricCousineau-TRI said can be PyYAML. Here is a link from stackoverflow addressing an workaround: https://stackoverflow.com/questions/30458977/yaml-loads-5e-6-as-string-and-not-a-number

Read more comments on GitHub >

github_iconTop Results From Across the Web

sweep: Parameter value written w/ scientific notation gets ...
When editing the code, I found that one of the parameters was getting converted to a string. Reproduction: ( set -eux; cd $(mktemp...
Read more >
Convert Scientific Notation to String - python - Stack Overflow
When I load xlsx file. I have a number IBAN with scientific notation. For example: 7.810500161524 ...
Read more >
TOPCAT - Tool for OPerations on Catalogues And Tables
If all the fields in one column can be parsed as integers (or null values), then that column will turn into an integer-type...
Read more >
Reverse Polish Notation - SDK Documentation
Here is a full example of how Reverse Polish Notation is used along with the available parameters and operands within the XML for...
Read more >
std::scientific - CPlusPlus.com
When floatfield is set to scientific , floating-point values are written using scientific notation: the value is represented always with only one digit ......
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