Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datamint/dataset/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ def prefetch(self, *, include_annotations: bool = False) -> None:
_LOGGER.info("Prefetch complete.")

def __getstate__(self) -> dict:
state = super().__getstate__()
# Strip _api (contains unpicklable connections)
get = getattr(super(), '__getstate__', None)
state = get() if get is not None else self.__dict__.copy()
if '_api' in state:
del state['_api']
return state
Expand Down
9 changes: 5 additions & 4 deletions tests/test_nnunet_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def perform_actual_validation(self, *a, **kw): pass
def print_to_log_file(self, *a, **kw): pass
submodules['nnunetv2.training.nnUNetTrainer.nnUNetTrainer'].nnUNetTrainer = _FakeNNUNetTrainer
for name, mod in submodules.items():
sys.modules.setdefault(name, mod)
sys.modules[name] = mod

_mock_nnunetv2()

Expand Down Expand Up @@ -94,9 +94,10 @@ def fake_fp():
def fake_plan():
(preprocessed_dir / 'nnUNetPlans.json').write_text('{}')

with patch('nnunetv2.experiment_planning.dataset_fingerprint'
'.fingerprint_extractor.DatasetFingerprintExtractor') as MockFP, \
patch('nnunetv2.experiment_planning.experiment_planners.default_experiment_planner.ExperimentPlanner') as MockPlan:
fp_mod = sys.modules['nnunetv2.experiment_planning.dataset_fingerprint.fingerprint_extractor']
plan_mod = sys.modules['nnunetv2.experiment_planning.experiment_planners.default_experiment_planner']
with patch.object(fp_mod, 'DatasetFingerprintExtractor') as MockFP, \
patch.object(plan_mod, 'ExperimentPlanner') as MockPlan:
MockFP.return_value.run.side_effect = fake_fp
MockPlan.return_value.plan_experiment.side_effect = fake_plan
trainer._run_fingerprint_and_plan(dataset_id=1)
Expand Down
Loading