Functional tools
- expert.core.functional_tools.get_torch_home() str[source]
Get Torch Hub cache directory used for storing downloaded models and weights.
- expert.core.functional_tools.get_model_folder(model_name: str, url: str) str[source]
Load folder with model weights from remote storage.
- expert.core.functional_tools.get_model_weights(model_name: str, url: str) str[source]
Load model weights from remote storage.
- expert.core.functional_tools.get_model_weights_url(model_name: str, url: str) str[source]
Load model weights from remote storage.
- expert.core.functional_tools.download_url_to_file(url: str, dst: str, hash_prefix: Optional[str] = None, progress: bool = True) str[source]
Download object at the given URL to a local path.
- Parameters
url (str) – URL of the object to download.
dst (str) – Full path where object will be saved, e.g. /tmp/temporary_file.
hash_prefix (str, optional) – If not None, the SHA256 downloaded file should start with hash_prefix. Defaults to None.
progress (bool, optional) – whether or not to display a progress bar to stderr. Defaults to True.
Example
>>> torch.hub.download_url_to_file('https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth', '/tmp/temporary_file')