autogluon.core.utils¶
Various built-in utility functions and objects that are used throughout AutoGluon.
Utils¶
Saves an object to local file. |
|
Loads an object saved with |
|
Download files from a given URL. |
|
Unzips files located at zip_file_path into parent directory specified by root. |
|
Check whether the sha1 hash of the file content matches the expected hash. |
|
Make directory at the specified local path with special error handling. |
save¶
-
autogluon.core.utils.
save
(obj, f, pickle_module=<module 'pickle' from '/var/lib/jenkins/miniconda3/envs/autogluon_docs/lib/python3.7/pickle.py'>, pickle_protocol=2)[source]¶ Saves an object to local file.
- Parameters
- objobject
Python object to save.
- fstring or file object
A file-like object (has to implement write and flush), or a string containing a file name
- pickle_modulepickle
Module used for pickling metadata and objects
- pickle_protocolprotocol (optional)
Protocol can be specified to override the default pickle protocol.
Examples
>>> save(scheduler.state_dict(), checkname)
load¶
-
autogluon.core.utils.
load
(f, map_location=None, pickle_module=<module 'pickle' from '/var/lib/jenkins/miniconda3/envs/autogluon_docs/lib/python3.7/pickle.py'>, **pickle_load_args)[source]¶ Loads an object saved with
save()
from file.- Parameters
- f (string or file object): a file-like object (has to implement write and flush)
or a string containing a file name
Examples
>>> scheduler.load_state_dict(load(checkpoint))
download¶
-
autogluon.core.utils.
download
(url, path=None, overwrite=False, sha1_hash=None)[source]¶ Download files from a given URL.
- Parameters
- urlstr
URL where file is located
- pathstr, optional
Destination path to store downloaded file. By default stores to the current directory with same name as in url.
- overwritebool, optional
Whether to overwrite destination file if one already exists at this location.
- sha1_hashstr, optional
Expected sha1 hash in hexadecimal digits (will ignore existing file when hash is specified but doesn’t match).
- Returns
- str
The file path of the downloaded file.