You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add checks for monai bundles after download and warn if incompatible (#7938)
Fixes#7930 .
### Description
Check the monai version in metadata JSON and warn if the version is
newer than the package being used.
### Demonstration
Warning when the version is hardcoded to 1.2 from monaihosting
```
root@MS-7D31:/workspace/MONAI# python -m monai.bundle download spleen_ct_segmentation
2024-07-23 11:00:31,286 - INFO - --- input summary of monai.bundle.scripts.download ---
2024-07-23 11:00:31,286 - INFO - > name: 'spleen_ct_segmentation'
2024-07-23 11:00:31,286 - INFO - > source: 'monaihosting'
2024-07-23 11:00:31,286 - INFO - > remove_prefix: 'monai_'
2024-07-23 11:00:31,286 - INFO - > progress: True
2024-07-23 11:00:31,286 - INFO - ---
2024-07-23 11:00:31,985 - INFO - Expected md5 is None, skip md5 check for file /root/.cache/torch/hub/bundle/spleen_ct_segmentation_v0.5.8.zip.
2024-07-23 11:00:31,986 - INFO - File exists: /root/.cache/torch/hub/bundle/spleen_ct_segmentation_v0.5.8.zip, skipped downloading.
2024-07-23 11:00:31,986 - INFO - Writing into directory: /root/.cache/torch/hub/bundle.
2024-07-23 11:00:32,176 - WARNING - Your MONAI version is 1.2, but the bundle is built on MONAI version 1.3.2.
```
Auto select version if the download src is from NGC
```
root@MS-7D31:/workspace/MONAI# BUNDLE_DOWNLOAD_SRC=ngc python -m monai.bundle download spleen_ct_segmentation
2024-07-23 11:02:12,277 - INFO - --- input summary of monai.bundle.scripts.download ---
2024-07-23 11:02:12,277 - INFO - > name: 'spleen_ct_segmentation'
2024-07-23 11:02:12,277 - INFO - > source: 'ngc'
2024-07-23 11:02:12,277 - INFO - > remove_prefix: 'monai_'
2024-07-23 11:02:12,277 - INFO - > progress: True
2024-07-23 11:02:12,277 - INFO - ---
monai_spleen_ct_segmentation_v0.3.7.zip: 34.0MB [00:01, 24.1MB/s]
2024-07-23 11:02:17,953 - INFO - Downloaded: /root/.cache/torch/hub/bundle/monai_spleen_ct_segmentation_v0.3.7.zip
2024-07-23 11:02:17,954 - INFO - Expected md5 is None, skip md5 check for file /root/.cache/torch/hub/bundle/monai_spleen_ct_segmentation_v0.3.7.zip.
2024-07-23 11:02:17,954 - INFO - Writing into directory: /root/.cache/torch/hub/bundle/spleen_ct_segmentation.
```
### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [x] New tests added to cover the changes.
- [x] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
---------
Signed-off-by: Mingxin Zheng <mingxinz@nvidia.com>
Signed-off-by: Mingxin Zheng <18563433+mingxin-zheng@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
0 commit comments