deepmd.pretrained.download#

Download and resolve pretrained model files.

Attributes#

Functions#

_validate_download_url(→ None)

Validate that download URL uses HTTPS scheme.

_sha256sum(→ str)

Calculate SHA256 checksum of a file.

_model_download_urls(→ list[str])

Return candidate download URLs (deduplicated and ordered).

_probe_download_url(→ float | None)

Probe one URL and return latency seconds if reachable; else None.

_rank_download_urls(→ list[str])

Rank candidate URLs by probe latency (fastest first).

_download_file(→ None)

Download URL content to destination atomically.

download_model(→ pathlib.Path)

Download one model and return local path.

resolve_model_path(→ pathlib.Path)

Resolve model alias to verified local file, downloading if needed.

Module Contents#

deepmd.pretrained.download.DEFAULT_CACHE_DIR[source]#
deepmd.pretrained.download.DOWNLOAD_TIMEOUT_SECONDS = 120[source]#
deepmd.pretrained.download.SOURCE_PROBE_TIMEOUT_SECONDS = 8[source]#
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.