rbgirshick / yacs

YACS -- Yet Another Configuration System
Apache License 2.0
1.28k stars 90 forks source link

data like 1e-3 loaded from yaml is with type str #46

Open xwu4lab opened 3 years ago

xwu4lab commented 3 years ago

It seems the decode is not performed when the value is loaded from file (such as yaml), so that data like 1e-3 will be recognized as str instead of float.

naokiyokoyama commented 2 years ago

This is because of how PyYAML loads the file. Yacs only has visibility to the dictionary generated by PyYAML, at which point "1e-3" has already been decoded as a string.

The way to fix your issue is to write "1.0e3" instead; then PyYAML will decode it as a float!