import torch


def load_ckp(model, ckp_path, device, parallel=False, strict=True):
    """Load checkpoint

    Args:
        ckp_path (str): path to checkpoint

    Returns:
        int, int: current epoch, current iteration
    """
    ckp = torch.load(ckp_path, map_location=device)
    if parallel:
        model.module.load_state_dict(
            ckp['state_dict'], strict=strict)
    else:
        model.load_state_dict(ckp['state_dict'], strict=strict)

    return ckp['epoch'], ckp['iter']