diag(vf): say where the value functions trained, and how big they are

"Training is slow" and "training is slow ON THE CPU with four million
parameters" are different problems with different fixes, and nothing in the log
told them apart — leaving it to be inferred from timings, which is how the
first guess at this went to the disk instead.

One line per run per value function, naming the device and the parameter count.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
digital-garbage
2026-08-25 14:34:26 +03:00
co-authored by Claude Opus 5
parent 8cdee7072f
commit 33227b198d
3 changed files with 39 additions and 0 deletions
+15
View File
@@ -90,3 +90,18 @@ def test_without_a_gpu_it_stays_home(monkeypatch):
monkeypatch.setattr(V.torch.cuda, "is_available", lambda: False)
home = torch.device("cpu")
assert V.OnlineValueFunction._training_device(torch.zeros(4), home) is home
def test_the_device_it_trained_on_is_recorded():
"""Reported once per run: "training is slow" and "training is slow ON THE CPU with four
million parameters" are different problems with different fixes."""
vf = _trained()
assert vf.last_train_device is None
vf.train_on(torch.randn(1, 8, 32), 0.5)
assert vf.last_train_device == "cpu"
def test_a_run_too_short_to_train_records_nothing():
vf = OnlineValueFunction(hidden_dim=32)
vf.train_on(torch.randn(1, 8, 32), 0.5) # one sample: no pair to rank
assert vf.last_train_device is None