Only record evaluation_seconds when eval actually ran

Previously the timer wrapped every call to _evaluate(), but on iterations
that skip eval (iteration % eval_every != 0) the function returns
immediately and the recorded value was just function-call overhead
(~3 µs), which made W&B show a wildly bimodal "evaluation_seconds"
metric. Now only set the key when eval_metrics is non-empty so
non-eval iterations have no data point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 17:26:12 +09:00
co-authored by Claude Opus 4.7
parent e6b7a41dc0
commit 5aab84c15f
@@ -325,6 +325,7 @@ class DeepCFRTrainer:
eval_started = time.perf_counter()
eval_metrics = self._evaluate(iteration)
if eval_metrics:
self._runtime_metrics["evaluation_seconds"] = time.perf_counter() - eval_started
self._runtime_metrics["advantage_memory_size"] = self._advantage_memory_size()
for player, memory in enumerate(self.advantage_memories):