Skip to content

Loading and saving neural models

load_model(path, device='cpu')

Loads a neural model from the disk.

Parameters:

Name Type Description Default
path str

file path to the saved file

required
device str

device onto which the model is loaded. Defaults to "cpu".

'cpu'

Returns:

Type Description
Module

torch.nn.Module: the loaded neural model

save_model(model, path)

Saves a neural model onto the disk.

Parameters:

Name Type Description Default
model Module

neural model to be saved

required
path str

file path to the saved file.

required