MichiganCOG / ViP

Video Platform for Action Recognition and Object Detection in Pytorch
MIT License
219 stars 37 forks source link

Parser does not support scientific notation #8

Closed lemmersj closed 5 years ago

lemmersj commented 5 years ago

Using scientific notation in the config file (e.g., lr: 1e-4) causes the json parser to read as a string, resulting in an error. Specifically in the case of learning rate this results in an error at line 96 of train (during the optimizer init), but is likely to result in errors elsewhere for different params.

natlouis commented 5 years ago

This looks like a YAML bug, that has a fix. But it hasn't been merged: https://github.com/yaml/pyyaml/pull/174

lemmersj commented 5 years ago

That pull request seems to be stale --- it hasn't been touched in a year, and there seems to be some concern with whether it is appropriate (e.g., the yaml 1.1 spec, which is what pyyaml is based on expects this behavior, while the 1.2 spec doesn't). By my reading, you can also work around this problem by putting a decimal in your scientific notation (but I haven't tested this).

Would we rather fix this for our convenience, or leave as is for compliance with YAML 1.1, and go with whatever the pyyaml folks do?

zeonzir commented 5 years ago

With PyYaml 5.1.1 I can confirm that scientific notation, as the post suggested, can be processed if a decimal point is added. This seems to be a yaml compliance issue and we can safely use the decimal to avoid any further issues as on this scientific notation in the current version of the repo.