Skip to content

Conversation

@Nic-Ma
Copy link
Contributor

@Nic-Ma Nic-Ma commented May 3, 2022

Fixes #4217 .

Description

This PR updated the PyTorch base docker and CI tests docker to 22.04.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 3, 2022

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 3, 2022

/build

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 3, 2022

/integration-test

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 3, 2022

Hi @rijobro ,

When I try to run our CI tests on the latest PyTorch docker, got the same error from MetaTensor test cases, like:

======================================================================
ERROR: test_copy_9 (__main__.TestMetaTensor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 533, in standalone_func
    return func(*(a + p.args), **p.kwargs)
  File "tests/test_meta_tensor.py", line 172, in test_copy
    a = deepcopy(m)
  File "/opt/conda/lib/python3.8/copy.py", line 153, in deepcopy
    y = copier(memo)
  File "/opt/conda/lib/python3.8/site-packages/torch/_tensor.py", line 86, in __deepcopy__
    return handle_torch_function(Tensor.__deepcopy__, (self,), self, memo)
  File "/opt/conda/lib/python3.8/site-packages/torch/overrides.py", line 1394, in handle_torch_function
    result = torch_func_method(public_api, types, args, kwargs)
  File "/workspace/data/medical/MONAI/monai/data/meta_tensor.py", line 187, in __torch_function__
    ret = super().__torch_function__(func, types, args, kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/_tensor.py", line 1178, in __torch_function__
    ret = func(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/_tensor.py", line 141, in __deepcopy__
    raise RuntimeError("The default implementation of __deepcopy__() for non-wrapper subclasses "
RuntimeError: The default implementation of __deepcopy__() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override __deepcopy__() if it is intended behavior for new_empty() to return an instance of a different type.

Do you have any idea?

Thanks in advance.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 3, 2022

BTW, except for the MetaTensor tests, I manually executed all the integration tests on V100 locally, all passed OK.

Thanks.

@rijobro
Copy link
Contributor

rijobro commented May 4, 2022

@wyli did any of your recent MetaTensor commits fix the issue @Nic-Ma is referring to, or do I still need to look into this? Thanks

@wyli
Copy link
Contributor

wyli commented May 4, 2022

@wyli did any of your recent MetaTensor commits fix the issue @Nic-Ma is referring to, or do I still need to look into this? Thanks

yes, I forgot to get back to the dev branch, I'll look into this.

@wyli wyli force-pushed the 4217-update-pytorch branch from b04343b to c095f92 Compare May 4, 2022 15:04
@wyli
Copy link
Contributor

wyli commented May 4, 2022

@wyli did any of your recent MetaTensor commits fix the issue @Nic-Ma is referring to, or do I still need to look into this? Thanks

yes, I forgot to get back to the dev branch, I'll look into this.

this seems to address the issue c095f92 please let me know if there's a better way

@Nic-Ma Nic-Ma marked this pull request as ready for review May 5, 2022 00:26
@Nic-Ma Nic-Ma changed the title [WIP] 4217 update pytorch 4217 Update PyTorch docker to 22..04 May 5, 2022
@Nic-Ma Nic-Ma changed the title 4217 Update PyTorch docker to 22..04 4217 Update PyTorch docker to 22.04 May 5, 2022
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 5, 2022

/build

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 5, 2022

@wyli @rijobro Thanks for your fix! This PR is ready for review now.

@Nic-Ma Nic-Ma requested review from ericspod, rijobro and wyli May 5, 2022 00:28
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 5, 2022

/build

1 similar comment
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented May 5, 2022

/build

Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, there might be a more efficient way to implement new_empty

self.as_tensor().new_empty(size=size, dtype=dtype, device=device, requires_grad=requires_grad)

@wyli wyli merged commit b10364c into Project-MONAI:dev May 5, 2022
wyli added a commit that referenced this pull request May 5, 2022
* add swin_unetr model (#4074)

* add swin_unetr model

* 4217 Update PyTorch docker to 22.04 (#4218)

* [DLMED] update to 22.04

Signed-off-by: Nic Ma <[email protected]>

* fixes unit test tests.test_lr_finder

Signed-off-by: Wenqi Li <[email protected]>

* test new_empty

Signed-off-by: Wenqi Li <[email protected]>

Co-authored-by: Wenqi Li <[email protected]>
Co-authored-by: Wenqi Li <[email protected]>

* Add InstanceNorm3dNVFuser support (#4194)

* implement the base class

Signed-off-by: Yiheng Wang <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add unittest

Signed-off-by: Yiheng Wang <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* autofix

Signed-off-by: Yiheng Wang <[email protected]>

* switch to call apex directly

Signed-off-by: Yiheng Wang <[email protected]>

* uncomment unittest

Signed-off-by: Yiheng Wang <[email protected]>

* add apex install link in docstring

Signed-off-by: Yiheng Wang <[email protected]>

* add channels_last_3d test case

Signed-off-by: Yiheng Wang <[email protected]>

* rewrite types

Signed-off-by: Yiheng Wang <[email protected]>

* change types

Signed-off-by: Yiheng Wang <[email protected]>

* add docstrings

Signed-off-by: Yiheng Wang <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Wenqi Li <[email protected]>

Co-authored-by: Ali Hatamizadeh <[email protected]>
Co-authored-by: Nic Ma <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Can-Zhao pushed a commit to Can-Zhao/MONAI that referenced this pull request May 10, 2022
* [DLMED] update to 22.04

Signed-off-by: Nic Ma <[email protected]>

* fixes unit test tests.test_lr_finder

Signed-off-by: Wenqi Li <[email protected]>

* test new_empty

Signed-off-by: Wenqi Li <[email protected]>

Co-authored-by: Wenqi Li <[email protected]>
Co-authored-by: Wenqi Li <[email protected]>
wyli pushed a commit that referenced this pull request May 13, 2022
* add swin_unetr model (#4074)

* add swin_unetr model

Signed-off-by: kbressem <[email protected]>

* 4217 Update PyTorch docker to 22.04 (#4218)

* [DLMED] update to 22.04

Signed-off-by: Nic Ma <[email protected]>

* fixes unit test tests.test_lr_finder

Signed-off-by: Wenqi Li <[email protected]>

* test new_empty

Signed-off-by: Wenqi Li <[email protected]>

Co-authored-by: Wenqi Li <[email protected]>
Co-authored-by: Wenqi Li <[email protected]>
Signed-off-by: kbressem <[email protected]>

* Add InstanceNorm3dNVFuser support (#4194)

* implement the base class

Signed-off-by: Yiheng Wang <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add unittest

Signed-off-by: Yiheng Wang <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* autofix

Signed-off-by: Yiheng Wang <[email protected]>

* switch to call apex directly

Signed-off-by: Yiheng Wang <[email protected]>

* uncomment unittest

Signed-off-by: Yiheng Wang <[email protected]>

* add apex install link in docstring

Signed-off-by: Yiheng Wang <[email protected]>

* add channels_last_3d test case

Signed-off-by: Yiheng Wang <[email protected]>

* rewrite types

Signed-off-by: Yiheng Wang <[email protected]>

* change types

Signed-off-by: Yiheng Wang <[email protected]>

* add docstrings

Signed-off-by: Yiheng Wang <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Wenqi Li <[email protected]>
Signed-off-by: kbressem <[email protected]>

* Update dice.py (#4234)

* Update dice.py

reduce redundant operations in DiceFocalLoss, initially caused oom

Signed-off-by: Ryan Clanton <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: Ryan Clanton <[email protected]>

* [MONAI] python code formatting

Signed-off-by: monai-bot <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: monai-bot <[email protected]>
Signed-off-by: kbressem <[email protected]>

* Bug fix and improvement in WSI (#4216)

* Make all transforms optional

Signed-off-by: Behrooz <[email protected]>

* Update wsireader tests

Signed-off-by: Behrooz <[email protected]>

* Remove optional from PersistentDataset and its derivatives

Signed-off-by: Behrooz <[email protected]>

* Add unittests for cache without transform

Signed-off-by: Behrooz <[email protected]>

* Add default replace_rate

Signed-off-by: Behrooz <[email protected]>

* Add default value

Signed-off-by: Behrooz <[email protected]>

* Set default replace_rate to 0.1

Signed-off-by: Behrooz <[email protected]>

* Update metadata to include path

Signed-off-by: Behrooz <[email protected]>

* Adds SmartCachePatchWSIDataset

Signed-off-by: Behrooz <[email protected]>

* Add unittests for SmartCachePatchWSIDataset

Signed-off-by: Behrooz <[email protected]>

* Update references

Signed-off-by: Behrooz <[email protected]>

* Update docs

Signed-off-by: Behrooz <[email protected]>

* Remove smart cache

Signed-off-by: Behrooz <[email protected]>

* Remove unused imports

Signed-off-by: Behrooz <[email protected]>

* Add path metadata for OpenSlide

Signed-off-by: Behrooz <[email protected]>

* Update metadata to be unified across different backends

Signed-off-by: Behrooz <[email protected]>

* Update wsi metadata for multi wsi objects

Signed-off-by: Behrooz <[email protected]>

* Add unittests for wsi metadata

Signed-off-by: Behrooz <[email protected]>
Signed-off-by: kbressem <[email protected]>

* Replace module (#4245)

* replace modules

Signed-off-by: Richard Brown <[email protected]>

* fix

Signed-off-by: Richard Brown <[email protected]>

* replace_module -> replace_modules

Signed-off-by: Richard Brown <[email protected]>

* fix

Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: kbressem <[email protected]>

* Add GaussianSmooth as antialiasing filter in Resize (#4249)

Signed-off-by: Can Zhao <[email protected]>
Signed-off-by: kbressem <[email protected]>

* 4235 fix 2204 nvfuser issue (#4241)

* reproduce issue

Signed-off-by: Yiheng Wang <[email protected]>

* remove 22.01 02

Signed-off-by: Yiheng Wang <[email protected]>

* remove other workflows

Signed-off-by: Yiheng Wang <[email protected]>

* run on pull request

Signed-off-by: Yiheng Wang <[email protected]>

* remove sleep

Signed-off-by: Yiheng Wang <[email protected]>

* test single layer forward

Signed-off-by: Yiheng Wang <[email protected]>

* add has_nvfuser

Signed-off-by: Yiheng Wang <[email protected]>

* add check within factory

Signed-off-by: Yiheng Wang <[email protected]>

* revert to original cron.yml

Signed-off-by: Yiheng Wang <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix old pt issue

Signed-off-by: Yiheng Wang <[email protected]>

* change to return directly if no cuda

Signed-off-by: Yiheng Wang <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: kbressem <[email protected]>

* Update to Bundle Specifiation (#4250)

* Update to bundle specifiation

Signed-off-by: Eric Kerfoot <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding description in spec discussing the saved Torchscript object's file storage behaviour, and tweaking ckpt_export to add .json extension

Signed-off-by: Eric Kerfoot <[email protected]>

* Annotating optional bundle files

Signed-off-by: Eric Kerfoot <[email protected]>

* Adjusted ckpt_export test

Signed-off-by: Eric Kerfoot <[email protected]>

* Fix

Signed-off-by: Eric Kerfoot <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: kbressem <[email protected]>

* Implement NrrdReader and NrrdImage classes

Signed-off-by: kbressem <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: kbressem <[email protected]>

* run auto style fixes on image_reader.py

Signed-off-by: kbressem <[email protected]>

* add NrrdReader to monai/data/__init__.py

Signed-off-by: kbressem <[email protected]>

* Change the way spatial information is handled in NrrdReader

Signed-off-by: kbressem <[email protected]>

* add tests for NrrdReader

Signed-off-by: kbressem <[email protected]>

* Add NrrdReader to list of possible readers for LoadImage

Signed-off-by: kbressem <[email protected]>

* autofix formating

Signed-off-by: kbressem <[email protected]>

* autofix formating

Signed-off-by: kbressem <[email protected]>

* change NrrdImage class to namedtuple and make flake8 happy

Signed-off-by: kbressem <[email protected]>

* Add pynrrd to requirements

Signed-off-by: kbressem <[email protected]>

* correct typing for namedtumple
make flake8 happy

Signed-off-by: kbressem <[email protected]>

* Add pynrrd info to `get_optional_config_values`
Changed NrrdImage to dataclass

Signed-off-by: kbressem <[email protected]>

* exclude test_nrrd_reader.py from min tests

Signed-off-by: kbressem <[email protected]>

* add pynrrd to config files

Signed-off-by: kbressem <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Change the way space is handled in the header. Now, if space is not in header, it is assumed to be LPS and converted to RAS. If space is defined and not LPS, nothing is done to prevent wrong conversions.

Signed-off-by: kbressem <[email protected]>

* add `TestLoadSaveNrrd` where it is tested if a nrrd file, created by ITKWriter can be loaded again. 2D and 3D files with no channels are tested

Signed-off-by: kbressem <[email protected]>

* autofix format


Co-authored-by: kbressem <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade PyTorch docker for release and CI tests

3 participants