def load_checkpoint_if_available(params: AttributeDict, model: nn.Module, optimizer: Optional[torch.optim.Optimizer]=None, scheduler: Optional[torch.optim.lr_scheduler._LRScheduler]=None) -> None:
    'Load checkpoint from file.\n\n    If params.start_epoch is positive, it will load the checkpoint from\n    `params.start_epoch - 1`. Otherwise, this function does nothing.\n\n    Apart from loading state dict for `model`, `optimizer` and `scheduler`,\n    it also updates `best_train_epoch`, `best_train_loss`, `best_valid_epoch`,\n    and `best_valid_loss` in `params`.\n\n    Args:\n      params:\n        The return value of :func:`get_params`.\n      model:\n        The training model.\n      optimizer:\n        The optimizer that we are using.\n      scheduler:\n        The learning rate scheduler we are using.\n    Returns:\n      Return None.\n    '
    if (params.start_epoch <= 0):
        return
    filename = (params.exp_dir / f'epoch-{(params.start_epoch - 1)}.pt')
    saved_params = load_checkpoint(filename, model=model, optimizer=optimizer, scheduler=scheduler)
    keys = ['best_train_epoch', 'best_valid_epoch', 'batch_idx_train', 'best_train_loss', 'best_valid_loss']
    for k in keys:
        params[k] = saved_params[k]
    return saved_params
Load checkpoint from file.

If params.start_epoch is positive, it will load the checkpoint from
`params.start_epoch - 1`. Otherwise, this function does nothing.

Apart from loading state dict for `model`, `optimizer` and `scheduler`,
it also updates `best_train_epoch`, `best_train_loss`, `best_valid_epoch`,
and `best_valid_loss` in `params`.

Args:
  params:
    The return value of :func:`get_params`.
  model:
    The training model.
  optimizer:
    The optimizer that we are using.
  scheduler:
    The learning rate scheduler we are using.
Returns:
  Return None.
def load_checkpoint_if_available(params: AttributeDict, model: nn.Module, optimizer: Optional[torch.optim.Optimizer]=None, scheduler: Optional[torch.optim.lr_scheduler._LRScheduler]=None) -> None:
    'Load checkpoint from file.\n\n    If params.start_epoch is positive, it will load the checkpoint from\n    `params.start_epoch - 1`. Otherwise, this function does nothing.\n\n    Apart from loading state dict for `model`, `optimizer` and `scheduler`,\n    it also updates `best_train_epoch`, `best_train_loss`, `best_valid_epoch`,\n    and `best_valid_loss` in `params`.\n\n    Args:\n      params:\n        The return value of :func:`get_params`.\n      model:\n        The training model.\n      optimizer:\n        The optimizer that we are using.\n      scheduler:\n        The learning rate scheduler we are using.\n    Returns:\n      Return None.\n    '
    if (params.start_epoch <= 0):
        return
    filename = (params.exp_dir / f'epoch-{(params.start_epoch - 1)}.pt')
    saved_params = load_checkpoint(filename, model=model, optimizer=optimizer, scheduler=scheduler)
    keys = ['best_train_epoch', 'best_valid_epoch', 'batch_idx_train', 'best_train_loss', 'best_valid_loss']
    for k in keys:
        params[k] = saved_params[k]
    return saved_params