torchoutil.hub.download module

download_file(
url: str,
dst: str | Path | None = '.',
*,
hash_prefix: str | None = None,
make_parents: bool = False,
make_intermediate: bool | None = None,
verbose: int = 0,
) Path[source]

Download file to target filepath or directory.

Args:

url: Target URL. dst: Target filepath or directory. None means current working directory. defaults to “.”. hash_prefix: Optional hash prefix present in destination filename. defaults to None. make_parents: If True, make intermediate directories to destination. defaults to False. make_intermediate: Deprecated: alias for ‘make_parents’. If not None, overwrite any value of ‘make_parents’. defaults to None. verbose: Verbose level. defaults to 0.

Returns:

Path to the downloaded file.