-
Notifications
You must be signed in to change notification settings - Fork 364
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
chore: Fix scientific notation in example yamls #2688
chore: Fix scientific notation in example yamls #2688
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @pjanowski on file. In order for us to review and merge your code, please start the CLA process at https://determined.ai/cla. After we approve your CLA, we will update the contributors list (private) and comment |
✔️ Deploy Preview for determined-ui ready! 🔨 Explore the source changes: 156886b 🔍 Inspect the deploy log: https://app.netlify.com/sites/determined-ui/deploys/60e61c31973c770008dbe635 😎 Browse the preview: https://deploy-preview-2688--determined-ui.netlify.app/ |
@pjanowski thank you for bringing this to our attention! I'm a bit concerned that you are hitting this issue, especially because
(notably, it does not seem to match the regex from the yaml 1.1 standard, replaced by 1.2 in 2009) So I would say that this is a bug in the yaml parser, not in the config files. I was pretty sure that interanlly we always used What are you running to reproduce the error on your local machine? |
Hi Ryan (@rb-determined-ai), thanks for taking a look at this with me. I'm using import yaml
with open('clm_config.yaml', 'r') as stream:
d=yaml.safe_load(stream)
lr = d['hyperparameters']['learning_rate']
print(lr)
print(type(lr)) Config:
Config:
Does that help? |
Yeah, you are using the not-1.2-compatible pyyaml package. There are rumors of 1.2 support with pyyaml, but nothing yet. Try it with ruamel.yaml: - import yaml
+ from ruamel import yaml
with open('clm_config.yaml', 'r') as stream:
d=yaml.safe_load(stream)
lr = d['hyperparameters']['learning_rate']
print(lr)
print(type(lr)) |
Ok, but then neither is Determined (using the ruamel package). I can try to dig into the code, but the behavior I posted above is what you get when using Determined in |
Can you share the exact command line you are using to reproduce this behavior? I don't need model code or config files I don't think. |
(A stack trace would also be helpful here) |
Yikes, you're absolutely right. Parsing the |
I'm open to either altering the strings to be pyyaml-compatible, since you already did the work, and I do agree it's a little bit better for users. Just sign the CLA and we can move forward. |
Just sent it to the specified email. |
@cla-bot[bot] check |
The cla-bot has been summoned, and re-checked this pull request! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Example yamls use scientific notation like 1e-5 which pyyaml parses as str instead of float. This is because pyyaml, while widespread, is not a yaml-1.2 compliant parser yet. Improve lives of users a bit by using yaml 1.1-friendly configs.
Description
Example yamls use scientific notation like
1e-5
which yamls parses asstr
instead offloat
. Determined is smart enough to convert this to float when submitting experiments to the server but not so when running in local mode. This leads to numerous errors when trying to operate on strings as if they were floats.Test Plan
Tested running experiments with and without this change locally and on the server/cluster.
Commentary (optional)
Another option would have been to upgrade the
_make_local_execution_exp_config
method to be smarter about parsing configs for local execution. The change here is simpler and conforms better to intended yaml syntax.Checklist
docs/release-notes/
.See Release Note for details.