paddlespeech.t2s.utils.checkpoint module

paddlespeech.t2s.utils.checkpoint.load_parameters(model, optimizer=None, checkpoint_dir=None, checkpoint_path=None)[source]

Load a specific model checkpoint from disk.

Args:
model (Layer):

model to load parameters.

optimizer (Optimizer, optional):

optimizer to load states if needed. Defaults to None.

checkpoint_dir (str, optional):

the directory where checkpoint is saved.

checkpoint_path (str, optional):

if specified, load the checkpoint stored in the checkpoint_path and the argument 'checkpoint_dir' will be ignored. Defaults to None.

Returns:
iteration (int): number of iterations that the loaded checkpoint has

been trained.

paddlespeech.t2s.utils.checkpoint.save_parameters(checkpoint_dir, iteration, model, optimizer=None)[source]

Checkpoint the latest trained model parameters.

Args:
checkpoint_dir (str):

the directory where checkpoint is saved.

iteration (int):

the latest iteration number.

model (Layer):

model to be checkpointed.

optimizer (Optimizer, optional):

optimizer to be checkpointed. Defaults to None.

Returns:

None