azula.hub

Utilities for downloading models.

Functions

get_hub_dir

Returns the cache directory used for storing models & weights.

set_hub_dir

Sets the cache directory used for storing models & weights.

download

Downloads data at a given URL to a local file.

Descriptions

azula.hub.get_hub_dir()[source]

Returns the cache directory used for storing models & weights.

azula.hub.set_hub_dir(cache_dir)[source]

Sets the cache directory used for storing models & weights.

azula.hub.download(url, filename=None, hash_prefix=None, extract=False, quiet=False)[source]

Downloads data at a given URL to a local file.

Parameters:
  • url (str) – A URL. Google Drive URLs are supported.

  • filename (str | None) – A local file name. If None, use the sanitized URL instead. If a file with the same name exists, the download is skipped.

  • hash_prefix (str | None) – The expected hash prefix of the file, formatted as "alg:prefix".

  • extract (bool) – Whether to extract archives or not.

  • quiet (bool) – Whether to keep it quiet in the terminal or not.

Returns:

The local file name. If extract=True, the local directory name containing the extracted files is returned instead.

Return type:

str