Skip to content

Commit fb4fd7c

Browse files
Added new flag to keep prediction not on device
1 parent 4a92224 commit fb4fd7c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nnunetv2/inference/predict_from_raw_data.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,9 @@ def predict_entry_point():
882882
help="Use this to set the device the inference should run with. Available options are 'cuda' "
883883
"(GPU), 'cpu' (CPU) and 'mps' (Apple M1/M2). Do NOT use this to set which GPU ID! "
884884
"Use CUDA_VISIBLE_DEVICES=X nnUNetv2_predict [...] instead!")
885+
parser.add_argument('--not_on_device', action='store_true', required=False, default=False,
886+
help="Set this flag to not keep the entire case on device. Recommended for large cases that "
887+
"occupy more VRAM than available")
885888
parser.add_argument('--disable_progress_bar', action='store_true', required=False, default=False,
886889
help='Set this flag to disable progress bar. Recommended for HPC environments (non interactive '
887890
'jobs)')
@@ -922,7 +925,7 @@ def predict_entry_point():
922925
predictor = nnUNetPredictor(tile_step_size=args.step_size,
923926
use_gaussian=True,
924927
use_mirroring=not args.disable_tta,
925-
perform_everything_on_device=True,
928+
perform_everything_on_device=not args.not_on_device,
926929
device=device,
927930
verbose=args.verbose,
928931
verbose_preprocessing=args.verbose,

0 commit comments

Comments
 (0)