Skip to content

Commit fabc198

Browse files
authored
Default downloading bundles from monaihosting (#7046)
Fixes #7044 ### Description Update to checking versions and downloading bundles from "monaihosting" as "hosting_storage_v1" is no longer being updated. ### 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). - [ ] 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`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: KumoLiu <yunl@nvidia.com>
1 parent 18a671a commit fabc198

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

monai/bundle/scripts.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
from monai.utils import (
4646
check_parent_dir,
4747
deprecated_arg,
48-
deprecated_arg_default,
4948
ensure_tuple,
5049
get_equivalent_dtype,
5150
min_version,
@@ -62,8 +61,8 @@
6261
logger = get_logger(module_name=__name__)
6362

6463
# set BUNDLE_DOWNLOAD_SRC="ngc" to use NGC source in default for bundle download
65-
# set BUNDLE_DOWNLOAD_SRC="monaihosting" to use monaihosting source in default for bundle download
66-
DEFAULT_DOWNLOAD_SOURCE = os.environ.get("BUNDLE_DOWNLOAD_SRC", "github")
64+
# set BUNDLE_DOWNLOAD_SRC="github" to use github source in default for bundle download
65+
DEFAULT_DOWNLOAD_SOURCE = os.environ.get("BUNDLE_DOWNLOAD_SRC", "monaihosting")
6766
PPRINT_CONFIG_N = 5
6867

6968

@@ -248,7 +247,6 @@ def _process_bundle_dir(bundle_dir: PathLike | None = None) -> Path:
248247
return Path(bundle_dir)
249248

250249

251-
@deprecated_arg_default("source", "github", "monaihosting", since="1.2", replaced="1.5")
252250
def download(
253251
name: str | None = None,
254252
version: str | None = None,
@@ -541,9 +539,8 @@ def load(
541539
return model
542540

543541

544-
@deprecated_arg_default("tag", "hosting_storage_v1", "dev", since="1.2", replaced="1.5")
545542
def _get_all_bundles_info(
546-
repo: str = "Project-MONAI/model-zoo", tag: str = "hosting_storage_v1", auth_token: str | None = None
543+
repo: str = "Project-MONAI/model-zoo", tag: str = "dev", auth_token: str | None = None
547544
) -> dict[str, dict[str, dict[str, Any]]]:
548545
if has_requests:
549546
if tag == "hosting_storage_v1":
@@ -586,9 +583,8 @@ def _get_all_bundles_info(
586583
return bundles_info
587584

588585

589-
@deprecated_arg_default("tag", "hosting_storage_v1", "dev", since="1.2", replaced="1.5")
590586
def get_all_bundles_list(
591-
repo: str = "Project-MONAI/model-zoo", tag: str = "hosting_storage_v1", auth_token: str | None = None
587+
repo: str = "Project-MONAI/model-zoo", tag: str = "dev", auth_token: str | None = None
592588
) -> list[tuple[str, str]]:
593589
"""
594590
Get all bundles names (and the latest versions) that are stored in the release of specified repository
@@ -621,12 +617,8 @@ def get_all_bundles_list(
621617
return bundles_list
622618

623619

624-
@deprecated_arg_default("tag", "hosting_storage_v1", "dev", since="1.2", replaced="1.5")
625620
def get_bundle_versions(
626-
bundle_name: str,
627-
repo: str = "Project-MONAI/model-zoo",
628-
tag: str = "hosting_storage_v1",
629-
auth_token: str | None = None,
621+
bundle_name: str, repo: str = "Project-MONAI/model-zoo", tag: str = "dev", auth_token: str | None = None
630622
) -> dict[str, list[str] | str]:
631623
"""
632624
Get the latest version, as well as all existing versions of a bundle that is stored in the release of specified
@@ -659,20 +651,16 @@ def get_bundle_versions(
659651
return {"latest_version": all_versions[-1], "all_versions": all_versions}
660652

661653

662-
@deprecated_arg_default("tag", "hosting_storage_v1", "dev", since="1.2", replaced="1.5")
663654
def get_bundle_info(
664655
bundle_name: str,
665656
version: str | None = None,
666657
repo: str = "Project-MONAI/model-zoo",
667-
tag: str = "hosting_storage_v1",
658+
tag: str = "dev",
668659
auth_token: str | None = None,
669660
) -> dict[str, Any]:
670661
"""
671-
Get all information
672-
(include "id", "name", "size", "download_count", "browser_download_url", "created_at", "updated_at") of a bundle
662+
Get all information (include "name" and "browser_download_url") of a bundle
673663
with the specified bundle name and version which is stored in the release of specified repository with the provided tag.
674-
Since v1.5, "hosting_storage_v1" will be deprecated in favor of 'dev', which contains only "name" and "browser_download_url".
675-
information about a bundle.
676664
In order to increase the rate limits of calling Github APIs, you can input your personal access token.
677665
Please check the following link for more details about rate limiting:
678666
https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting

tests/test_bundle_get_data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121

2222
requests, _ = optional_import("requests")
2323

24-
TEST_CASE_1 = [{"bundle_name": "brats_mri_segmentation"}]
24+
TEST_CASE_1 = [{"bundle_name": "brats_mri_segmentation", "tag": "hosting_storage_v1"}]
2525

26-
TEST_CASE_2 = [{"bundle_name": "spleen_ct_segmentation", "version": "0.1.0", "auth_token": None}]
26+
TEST_CASE_2 = [
27+
{"bundle_name": "spleen_ct_segmentation", "version": "0.1.0", "auth_token": None, "tag": "hosting_storage_v1"}
28+
]
2729

2830
TEST_CASE_3 = [{"tag": "hosting_storage_v1"}]
2931

0 commit comments

Comments
 (0)