Skip to content

Commit 8667edb

Browse files
committed
cleanup
1 parent 36fbe25 commit 8667edb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

users/zeyer/experiments/exp2023_04_25_rf/auto_rnd_init.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def test():
4444
model: Model = from_scratch_model_def(epoch=1, in_dim=Dim(1, name="in"), target_dim=target_dim)
4545
print("Num model parameters:", util.human_size(sum(p.num_elements() for p in model.parameters())))
4646

47-
dev = torch.device("cuda")
4847
rf.set_default_device("cuda")
4948
model.to(device=rf.get_default_device())
50-
print(f"GPU memory usage (allocated model): {util.human_bytes_size(torch.cuda.memory_allocated(dev))}")
49+
pt_dev = torch.device(rf.get_default_device())
50+
print(f"GPU memory usage (allocated model): {util.human_bytes_size(torch.cuda.memory_allocated(pt_dev))}")
5151

5252
train_input_kwargs = generate_dummy_train_input_kwargs(dev=rf.get_default_device(), target_dim=target_dim)
5353

@@ -58,7 +58,7 @@ def test():
5858
with torch.no_grad():
5959
from_scratch_training(model=model, **train_input_kwargs)
6060
print("One train forward step, duration:", util.hms_fraction(time.time() - start_time), "sec")
61-
print(f"GPU peak memory allocated: {util.human_bytes_size(torch.cuda.max_memory_allocated(dev))}")
61+
print(f"GPU peak memory allocated: {util.human_bytes_size(torch.cuda.max_memory_allocated(pt_dev))}")
6262

6363
for name, loss in rf.get_run_ctx().losses.items():
6464
print(f"Loss {name}: {loss.get_mean_loss().raw_tensor.item()}")

0 commit comments

Comments
 (0)