fastnlp / fitlog

fitlog是一款在深度学习训练中用于辅助用户记录日志和管理代码的工具
https://gitee.com/fastnlp/fitlog
Apache License 2.0
1.47k stars 128 forks source link

There is problem when add logger add 'nan' #65

Closed ztxtech closed 1 year ago

ztxtech commented 1 year ago

_parse_value and _check_dict_value need to distinguish 'nan' and 'inf'.

ScarlettChan commented 1 year ago

您好,您的邮件已收到!

ztxtech commented 1 year ago
    elif isinstance(value, (np.floating, float)):
        if math.isnan(value) or math.isinf(value):
            _dict[key] = "nan"
        else:
            _dict[key] = float(value)

_parse_value

ztxtech commented 1 year ago
if isinstance(value, (int, float, str, bool)) or value is None:
    if isinstance(value, float):
        if math.isnan(value) or math.isinf(value):
            value = "nan"

——————————————————— _check_dict_value

yhcc commented 1 year ago

Thanks for pointing out this issue, would you mind send a pr to fix this?

ztxtech commented 1 year ago

I have sent a pr.

yhcc commented 1 year ago

The pr has been merge, thx~