Skip to content

Commit 0dff8e2

Browse files
committed
Show LR from scheduler and fix memory device print
1 parent abe207a commit 0dff8e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

napari_cellseg3d/code_models/worker_training.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ def get_loader_func(num_samples):
546546
if device.type == "cuda":
547547
self.log("Memory Usage:")
548548
alloc_mem = round(
549-
torch.cuda.memory_allocated(0) / 1024**3, 1
549+
torch.cuda.memory_allocated(device_id) / 1024**3, 1
550550
)
551551
reserved_mem = round(
552-
torch.cuda.memory_reserved(0) / 1024**3, 1
552+
torch.cuda.memory_reserved(device_id) / 1024**3, 1
553553
)
554554
self.log(f"Allocated: {alloc_mem}GB")
555555
self.log(f"Cached: {reserved_mem}GB")
@@ -593,6 +593,9 @@ def get_loader_func(num_samples):
593593

594594
self.log("Updating scheduler...")
595595
scheduler.step(epoch_loss)
596+
self.log(
597+
f"Current learning rate: {optimizer.param_groups[0]['lr']}"
598+
)
596599

597600
checkpoint_output = []
598601
eta = (

0 commit comments

Comments
 (0)