Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python yaml package does not parse all float values correctly. #23

Open
dhruvdcoder opened this issue Apr 14, 2021 · 2 comments
Open

Python yaml package does not parse all float values correctly. #23

dhruvdcoder opened this issue Apr 14, 2021 · 2 comments

Comments

@dhruvdcoder
Copy link
Owner

dhruvdcoder commented Apr 14, 2021

For example, a value 1e-5 will be parsed as a string "1e-5" instead of a float.

Possible solutions:

  1. Have a special regex to parse this before we parse using yaml.load.
  2. You another yaml package like ruamel

How to by-pass the issue without fixing?
Use environment variable to get the value to the jsonnet instead of command line override.

Ref: https://stackoverflow.com/questions/30458977/yaml-loads-5e-6-as-string-and-not-a-number

@dhruvdcoder
Copy link
Owner Author

Update: Using environment variable does not work either. Even jsonnet parsers that value as string.

The best way to circumvent this is to make sure that the sweep does not send float values in the e notation.

@dhruvdcoder
Copy link
Owner Author

Update: Using the env variable does not work because even that goes through yaml.load. Moreover, even when the values are not specified in 1e.. notation in the sweep config. The wandb server always sends values in 1e... format when there are more than 5 decimal places. So the only way forward is fixing the yaml load or using json.loads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant