Skip to content

Commit 5a04fe0

Browse files
nibabel importing moved to setUp
1 parent 49dbb5d commit 5a04fe0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

monai/bundle/nnunet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __init__(self, predictor, model_folder, model_name="model.pt"):
248248
if (
249249
("nnUNet_compile" in os.environ.keys())
250250
and (os.environ["nnUNet_compile"].lower() in ("true", "1", "t"))
251-
#and not isinstance(predictor.network, OptimizedModule)
251+
# and not isinstance(predictor.network, OptimizedModule)
252252
):
253253
print("Using torch.compile")
254254
predictor.network = torch.compile(self.network)

tests/test_integration_nnunet_bundle.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import unittest
1717
from pathlib import Path
1818

19-
import nibabel as nib
2019
import numpy as np
2120

2221
from monai.apps.nnunet import nnUNetV2Runner
@@ -54,6 +53,8 @@
5453
class TestnnUNetBundle(unittest.TestCase):
5554

5655
def setUp(self) -> None:
56+
import nibabel as nib
57+
5758
self.test_dir = tempfile.TemporaryDirectory()
5859
test_path = self.test_dir.name
5960

@@ -86,7 +87,9 @@ def setUp(self) -> None:
8687

8788
@skip_if_no_cuda
8889
def test_nnunet_bundle(self) -> None:
89-
runner = nnUNetV2Runner(input_config=self.data_src_cfg, trainer_class_name="nnUNetTrainer_1epoch",work_dir=self.test_path)
90+
runner = nnUNetV2Runner(
91+
input_config=self.data_src_cfg, trainer_class_name="nnUNetTrainer_1epoch", work_dir=self.test_path
92+
)
9093
with skip_if_downloading_fails():
9194
runner.run(run_train=False, run_find_best_configuration=False, run_predict_ensemble_postprocessing=False)
9295

0 commit comments

Comments
 (0)