deepmd.pretrained.download#
Download and resolve pretrained model files.
Attributes#
Functions#
| Validate that download URL uses HTTPS scheme. |
| Calculate SHA256 checksum of a file. |
| Return candidate download URLs (deduplicated and ordered). |
| Probe one URL and return latency seconds if reachable; else None. |
| Rank candidate URLs by probe latency (fastest first). |
| Download URL content to destination atomically. |
| Download one model and return local path. |
| Resolve model alias to verified local file, downloading if needed. |
Module Contents#
- deepmd.pretrained.download._validate_download_url(url: str) None[source]#
Validate that download URL uses HTTPS scheme.
- deepmd.pretrained.download._sha256sum(path: pathlib.Path) str[source]#
Calculate SHA256 checksum of a file.
- deepmd.pretrained.download._model_download_urls(model_info: dict[str, Any]) list[str][source]#
Return candidate download URLs (deduplicated and ordered).
- deepmd.pretrained.download._probe_download_url(url: str) float | None[source]#
Probe one URL and return latency seconds if reachable; else None.
- deepmd.pretrained.download._rank_download_urls(urls: list[str]) list[str][source]#
Rank candidate URLs by probe latency (fastest first).
- deepmd.pretrained.download._download_file(url: str, destination: pathlib.Path) None[source]#
Download URL content to destination atomically.
- deepmd.pretrained.download.download_model(model_name: str, *, cache_dir: pathlib.Path | None = None, logger: logging.Logger | None = None) pathlib.Path[source]#
Download one model and return local path.
The function will probe all configured sources, try the fastest reachable source first, and then fallback to others when failure happens.
- deepmd.pretrained.download.resolve_model_path(model_name: str, *, cache_dir: pathlib.Path | None = None, logger: logging.Logger | None = None) pathlib.Path[source]#
Resolve model alias to verified local file, downloading if needed.