joblib.load

joblib.load(filename, mmap_mode=None)

Reconstruct a Python object from a file persisted with joblib.dump.

Read more in the User Guide.

WARNING: joblib.load relies on the pickle module and can therefore execute arbitrary Python code. It should therefore never be used to load files from untrusted sources.

Parameters
filename: str, pathlib.Path, or file object.

The file object or path of the file from which to load the object

mmap_mode: {None, ‘r+’, ‘r’, ‘w+’, ‘c’}, optional

If not None, the arrays are memory-mapped from the disk. This mode has no effect for compressed files. Note that in this case the reconstructed object might no longer match exactly the originally pickled object.

Returns
result: any Python object

The object stored in the file.

See also

joblib.dump

function to save an object

Notes

This function can load numpy array files saved separately during the dump. If the mmap_mode argument is given, it is passed to np.load and arrays are loaded as memmaps. As a consequence, the reconstructed object might not match the original pickled object. Note that if the file was saved with compression, the arrays cannot be memmapped.

Examples using joblib.load

NumPy memmap in joblib.Parallel

NumPy memmap in joblib.Parallel

Improving I/O using compressors

Improving I/O using compressors