Skip to content

Commit

Permalink
Fix NaN json serialization in Aim GetRunMetrics (G-Research#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgiannuzzi committed Oct 16, 2023
1 parent b7632fc commit 1143665
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/api/aim/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,19 @@ func GetRunMetrics(c *fiber.Ctx) error {
}

metrics := make(map[string]struct {
values []float64
values []*float64
iters []int
}, len(metricKeys))
for _, m := range r.Metrics {
k := metrics[m.Key]

v := m.Value
pv := &v
if m.IsNan {
v = math.NaN()
pv = nil
}

k.values = append(k.values, v)
k.values = append(k.values, pv)
k.iters = append(k.iters, int(m.Iter))
metrics[m.Key] = k
}
Expand Down

0 comments on commit 1143665

Please sign in to comment.