File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
napari_cellseg3d/code_models Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -787,7 +787,11 @@ def train(
787787 criterionW = None
788788 del criterionW
789789 torch .cuda .empty_cache ()
790+ if WANDB_INSTALLED :
791+ wandb .finish ()
790792 except Exception as e :
793+ if WANDB_INSTALLED :
794+ wandb .finish ()
791795 msg = f"Training failed with exception: { e } "
792796 self .log (msg )
793797 self .raise_error (e , msg )
@@ -1726,6 +1730,9 @@ def get_patch_loader_func(num_samples):
17261730 )
17271731 self .log ("Saving complete, exiting" )
17281732 model .to ("cpu" )
1733+
1734+ if WANDB_INSTALLED :
1735+ wandb .finish ()
17291736 # clear (V)RAM
17301737 model = None
17311738 del model
@@ -1741,6 +1748,8 @@ def get_patch_loader_func(num_samples):
17411748 torch .cuda .empty_cache ()
17421749
17431750 except Exception as e :
1751+ if WANDB_INSTALLED :
1752+ wandb .finish ()
17441753 self .raise_error (e , "Error in training" )
17451754 self .quit ()
17461755 finally :
You can’t perform that action at this time.
0 commit comments