Spaces:
Runtime error
Runtime error
fix error when a loss was infinity
Browse files
app.py
CHANGED
@@ -119,7 +119,7 @@ def get_avg_loss(uids: typing.List[int]) -> typing.Dict[int, float]:
|
|
119 |
continue
|
120 |
key = f"uid_data.{uid}"
|
121 |
if key in history:
|
122 |
-
data = [x for x in list(history[key]) if not math.isnan(x)][-MAX_AVG_LOSS_POINTS:]
|
123 |
if len(data) > 0:
|
124 |
result[uid] = statistics.fmean(data)
|
125 |
if len(result.keys()) == len(uids):
|
|
|
119 |
continue
|
120 |
key = f"uid_data.{uid}"
|
121 |
if key in history:
|
122 |
+
data = [float(x) for x in list(history[key]) if (isinstance(x, float) and not math.isnan(x)) or isinstance(x, int) ][-MAX_AVG_LOSS_POINTS:]
|
123 |
if len(data) > 0:
|
124 |
result[uid] = statistics.fmean(data)
|
125 |
if len(result.keys()) == len(uids):
|