You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
trainer.evaluate of metrics is inconsistent due to batch-wise aggregation #859
Hey @Dreamwavedata sorry for the late response, it'd be easier to chat on discord haha about this. We do have some scripts, mostly with our EEG dataset. But, tldr; if you try to benchmark a model and a dataset repeatedly (even a small one), despite setting a seed, sometimes the output metrics come out different. @Jathurshan0330 can probably better describe it.
Checked on current master (98d0026). The metrics part is resolved: Trainer.evaluate now concatenates all batches and computes the metrics once, and two runs with the same set_seed and seeded get_dataloader gave identical scores on synthetic data. One batch-size effect was left: the reported loss was the mean of per-batch means, so it changed with the eval batch size (0.661 vs 0.597 for 23 samples split 22 + 1). #1628 weights it by batch size. If you still see run-to-run differences with a fixed seed, the script you mentioned (EEG) would help pin it down.
Activity
Dreamwavedata commentedon Feb 19, 2026
Hi! I'm interested in working on this as a contribution. Is it still available?
jhnwu3 commentedon Feb 19, 2026
Yeah, happy to take any help @Dreamwavedata
Dreamwavedata commentedon Feb 19, 2026
@jhnwu3
Thank you! Is there more information on this bug?
jhnwu3 commentedon Mar 6, 2026
Hey @Dreamwavedata sorry for the late response, it'd be easier to chat on discord haha about this. We do have some scripts, mostly with our EEG dataset. But, tldr; if you try to benchmark a model and a dataset repeatedly (even a small one), despite setting a seed, sometimes the output metrics come out different. @Jathurshan0330 can probably better describe it.
fix: resolve eval mode from output processors, fix loss aggregation (s…
fix: resolve eval mode from output processors, fix loss aggregation (s…
solarsys commentedon Nov 27, 2026
Checked on current master (98d0026). The metrics part is resolved:
Trainer.evaluatenow concatenates all batches and computes the metrics once, and two runs with the sameset_seedand seededget_dataloadergave identical scores on synthetic data. One batch-size effect was left: the reportedlosswas the mean of per-batch means, so it changed with the eval batch size (0.661 vs 0.597 for 23 samples split 22 + 1). #1628 weights it by batch size. If you still see run-to-run differences with a fixed seed, the script you mentioned (EEG) would help pin it down.