download bundle from the specified source or url. The bundle should be a zip file and it will be extracted after downloading. This function refers to: https://pytorch.org/docs/stable/_modules/torch/hub.html Typical usage examples: .. code-block:: bash # Execute th
(
name: str | None = None,
version: str | None = None,
bundle_dir: PathLike | None = None,
source: str = DEFAULT_DOWNLOAD_SOURCE,
repo: str | None = None,
url: str | None = None,
remove_prefix: str | None = "monai_",
progress: bool = True,
args_file: str | None = None,
)
| 444 | |
| 445 | |
| 446 | def download( |
| 447 | name: str | None = None, |
| 448 | version: str | None = None, |
| 449 | bundle_dir: PathLike | None = None, |
| 450 | source: str = DEFAULT_DOWNLOAD_SOURCE, |
| 451 | repo: str | None = None, |
| 452 | url: str | None = None, |
| 453 | remove_prefix: str | None = "monai_", |
| 454 | progress: bool = True, |
| 455 | args_file: str | None = None, |
| 456 | ) -> None: |
| 457 | """ |
| 458 | download bundle from the specified source or url. The bundle should be a zip file and it |
| 459 | will be extracted after downloading. |
| 460 | This function refers to: |
| 461 | https://pytorch.org/docs/stable/_modules/torch/hub.html |
| 462 | |
| 463 | Typical usage examples: |
| 464 | |
| 465 | .. code-block:: bash |
| 466 | |
| 467 | # Execute this module as a CLI entry, and download bundle from the model-zoo repo: |
| 468 | python -m monai.bundle download --name <bundle_name> --version "0.1.0" --bundle_dir "./" |
| 469 | |
| 470 | # Execute this module as a CLI entry, and download bundle from specified github repo: |
| 471 | python -m monai.bundle download --name <bundle_name> --source "github" --repo "repo_owner/repo_name/release_tag" |
| 472 | |
| 473 | # Execute this module as a CLI entry, and download bundle from ngc with latest version: |
| 474 | python -m monai.bundle download --name <bundle_name> --source "ngc" --bundle_dir "./" |
| 475 | |
| 476 | # Execute this module as a CLI entry, and download bundle from monaihosting with latest version: |
| 477 | python -m monai.bundle download --name <bundle_name> --source "monaihosting" --bundle_dir "./" |
| 478 | |
| 479 | # Execute this module as a CLI entry, and download bundle from Hugging Face Hub: |
| 480 | python -m monai.bundle download --name "bundle_name" --source "huggingface_hub" --repo "repo_owner/repo_name" |
| 481 | |
| 482 | # Execute this module as a CLI entry, and download bundle via URL: |
| 483 | python -m monai.bundle download --name <bundle_name> --url <url> |
| 484 | |
| 485 | # Execute this module as a CLI entry, and download bundle from ngc_private with latest version: |
| 486 | python -m monai.bundle download --name <bundle_name> --source "ngc_private" --bundle_dir "./" --repo "org/org_name" |
| 487 | |
| 488 | # Set default args of `run` in a JSON / YAML file, help to record and simplify the command line. |
| 489 | # Other args still can override the default args at runtime. |
| 490 | # The content of the JSON / YAML file is a dictionary. For example: |
| 491 | # {"name": "spleen", "bundle_dir": "download", "source": ""} |
| 492 | # then do the following command for downloading: |
| 493 | python -m monai.bundle download --args_file "args.json" --source "github" |
| 494 | |
| 495 | Args: |
| 496 | name: bundle name. If `None` and `url` is `None`, it must be provided in `args_file`. |
| 497 | for example: |
| 498 | "spleen_ct_segmentation", "prostate_mri_anatomy" in model-zoo: |
| 499 | https://github.com/Project-MONAI/model-zoo/releases/tag/hosting_storage_v1. |
| 500 | "monai_brats_mri_segmentation" in ngc: |
| 501 | https://catalog.ngc.nvidia.com/models?filters=&orderBy=scoreDESC&query=monai. |
| 502 | version: version name of the target bundle to download, like: "0.1.0". If `None`, will download |
| 503 | the latest version (or the last commit to the `main` branch in the case of Hugging Face Hub). |
searching dependent graphs…