Closed silvandeleemput closed 2 years ago
Awesome!
The training tests are failing now, I'll start investigating...
Strange typing error in batchgenerators, I'll try reproducing it locally, it might have been introduced going from 0.23 -> 0.24.
tests/test_training.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nnunet/run/default_configuration.py:59: in get_default_configuration
trainer_class = recursive_find_python_class([join(*search_in)], network_trainer,
nnunet/training/model_restore.py:37: in recursive_find_python_class
tr = recursive_find_python_class([join(folder[0], modname)], trainer_name, current_module=next_current_module)
nnunet/training/model_restore.py:37: in recursive_find_python_class
tr = recursive_find_python_class([join(folder[0], modname)], trainer_name, current_module=next_current_module)
nnunet/training/model_restore.py:28: in recursive_find_python_class
m = importlib.import_module(current_module + "." + modname)
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:671: in _load_unlocked
???
<frozen importlib._bootstrap_external>:848: in exec_module
???
<frozen importlib._bootstrap>:[219](https://github.com/DIAGNijmegen/nnUNet/runs/6504419310?check_suite_focus=true#step:3:220): in _call_with_frames_removed
???
nnunet/training/network_training/nnUNet_variants/data_augmentation/nnUNetTrainerV2_DA5.py:22: in <module>
from batchgenerators.transforms.local_transforms import BrightnessGradientAdditiveTransform, LocalGammaTransform
/usr/local/lib/python3.8/dist-packages/batchgenerators/transforms/local_transforms.py:21: in <module>
from batchgenerators.utilities.custom_types import ScalarType, sample_scalar
/usr/local/lib/python3.8/dist-packages/batchgenerators/utilities/custom_types.py:19: in <module>
ScalarType = Union[Union[int, float], Tuple[float, float], Callable[[Any, ...], Union[float, int]]]
/usr/lib/python3.8/typing.py:816: in __getitem__
return self.__getitem_inner__(params)
/usr/lib/python3.8/typing.py:261: in inner
return func(*args, **kwds)
/usr/lib/python3.8/typing.py:839: in __getitem_inner__
args = tuple(_type_check(arg, msg) for arg in args)
/usr/lib/python3.8/typing.py:839: in <genexpr>
args = tuple(_type_check(arg, msg) for arg in args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
arg = Ellipsis, msg = 'Callable[[arg, ...], result]: each arg must be a type.'
is_argument = True
def _type_check(arg, msg, is_argument=True):
"""Check that the argument is a type, and return it (internal helper).
As a special case, accept None and return type(None) instead. Also wrap strings
into ForwardRef instances. Consider several corner cases, for example plain
special forms like Union are not valid, while Union[int, str] is OK, etc.
The msg argument is a human-readable error message, e.g::
"Union[arg, ...]: arg should be a type."
We append the repr() of the actual value (truncated to 100 chars).
"""
invalid_generic_forms = (Generic, Protocol)
if is_argument:
invalid_generic_forms = invalid_generic_forms + (ClassVar, Final)
if arg is None:
return type(None)
if isinstance(arg, str):
return ForwardRef(arg)
if (isinstance(arg, _GenericAlias) and
arg.__origin__ in invalid_generic_forms):
raise TypeError(f"{arg} is not valid as type argument")
if (isinstance(arg, _SpecialForm) and arg not in (Any, NoReturn) or
arg in (Generic, Protocol)):
raise TypeError(f"Plain {arg} is not valid as type argument")
if isinstance(arg, (type, TypeVar, ForwardRef)):
return arg
if not callable(arg):
> raise TypeError(f"{msg} Got {arg!r:.100}.")
E TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.
Ok, nevermind, all seems good now. I just needed to remove the old docker containers from the private runners and use freshly build ones. This PR should be good to go.
This PR pulls and merges the latest changes from the original nnUNet master branch (https://github.com/MIC-DKFZ/nnUNet).