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

Fix search space compatibility with JSON #4455

Merged
merged 3 commits into from Jan 10, 2022
Merged

Conversation

liuzhe-lz
Copy link
Contributor

@liuzhe-lz liuzhe-lz commented Jan 10, 2022

Description

As of now the latest version of PyYAML (6.0) does not support YAML 1.2, which means it is not fully compatible with JSON.
This has caused multiple problems for NNI: #4450 #4452

The PR partially fixed this bug by trying YAML and JSON loaders consecutively. However if a user uses comment and scientific notation at same time, NNI will still fail.
Since PyYAML has already been working on YAML 1.2 support, I prefer to wait for its update for a perfect fix.

As a reminder, ruamel.yaml supports YAML 1.2, but according to our previous experience it's pip package and conda package have inconsistent APIs, which caused even more problems.

Checklist

  • test case
  • doc

How to test

Create tricky JSON search space file and make sure it's loaded correctly.

try:
return json.loads(content)
except Exception:
return yaml.safe_load(content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the yaml format search space still does not support scientific notation, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't.

@liuzhe-lz liuzhe-lz merged commit 31f11f5 into microsoft:master Jan 10, 2022
@liuzhe-lz liuzhe-lz deleted the json-ss branch January 10, 2022 17:24
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

Successfully merging this pull request may close these issues.

None yet

4 participants