mirror of
https://github.com/clearml/clearml
synced 2025-02-12 07:35:08 +00:00
Fix NaN, Inf and -Inf values in reported table (not supported by JSON)
This commit is contained in:
parent
d48fa33744
commit
2848e9190e
@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Sequence, Union, List, Optional, Tuple
|
from typing import Any, Sequence, Union, List, Optional, Tuple
|
||||||
|
|
||||||
@ -299,10 +300,19 @@ class Logger(object):
|
|||||||
elif csv:
|
elif csv:
|
||||||
table = pd.read_csv(csv)
|
table = pd.read_csv(csv)
|
||||||
|
|
||||||
|
def replace(dst, *srcs):
|
||||||
|
for src in srcs:
|
||||||
|
reporter_table.replace(src, dst, inplace=True)
|
||||||
|
|
||||||
|
reporter_table = table.fillna(str(np.nan))
|
||||||
|
replace("NaN", np.nan, math.nan)
|
||||||
|
replace("Inf", np.inf, math.inf)
|
||||||
|
replace("-Inf", -np.inf, np.NINF, -math.inf)
|
||||||
|
|
||||||
return self._task.reporter.report_table(
|
return self._task.reporter.report_table(
|
||||||
title=title,
|
title=title,
|
||||||
series=series,
|
series=series,
|
||||||
table=table,
|
table=reporter_table,
|
||||||
iteration=iteration
|
iteration=iteration
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user