Skip to content

Commit 8f3d8e8

Browse files
Update get latest bundle version function (#8420)
### Description Based on the changes in: Project-MONAI/model-zoo#739 All model zoo bundles are updated a new version in HuggingFace. Therefore, `_get_latest_bundle_version_monaihosting` should be updated accordingly ### 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`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Yiheng Wang <[email protected]>
1 parent eadffd2 commit 8f3d8e8

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

monai/bundle/scripts.py

+1-16
Original file line numberDiff line numberDiff line change
@@ -312,21 +312,6 @@ def _get_ngc_token(api_key, retry=0):
312312
return token
313313

314314

315-
def _get_latest_bundle_version_monaihosting(name):
316-
full_url = f"{MONAI_HOSTING_BASE_URL}/{name.lower()}"
317-
if has_requests:
318-
resp = requests.get(full_url)
319-
try:
320-
resp.raise_for_status()
321-
model_info = json.loads(resp.text)
322-
return model_info["model"]["latestVersionIdStr"]
323-
except requests.exceptions.HTTPError:
324-
# for monaihosting bundles, if cannot find the version, get from model zoo model_info.json
325-
return get_bundle_versions(name)["latest_version"]
326-
327-
raise ValueError("NGC API requires requests package. Please install it.")
328-
329-
330315
def _examine_monai_version(monai_version: str) -> tuple[bool, str]:
331316
"""Examine if the package version is compatible with the MONAI version in the metadata."""
332317
version_dict = get_versions()
@@ -430,7 +415,7 @@ def _get_latest_bundle_version(
430415
name = _add_ngc_prefix(name)
431416
return _get_latest_bundle_version_ngc(name)
432417
elif source == "monaihosting":
433-
return _get_latest_bundle_version_monaihosting(name)
418+
return get_bundle_versions(name, repo="Project-MONAI/model-zoo", tag="dev")["latest_version"]
434419
elif source == "ngc_private":
435420
headers = kwargs.pop("headers", {})
436421
name = _add_ngc_prefix(name)

0 commit comments

Comments
 (0)