import torch


def load_ckp(model, optimizer, lr_scheduler, path):
    """load training checkpoint"""

    checkpoint = torch.load(path)

    model.load_state_dict(checkpoint['model_state_dict'])
    optimizer.load_state_dict(checkpoint['optimizer_state_dict'])
    lr_scheduler.load_state_dict(checkpoint['lr_scheduler_state_dict'])

    epoch = checkpoint['epoch']
    train_loss = checkpoint['train_loss']
    val_loss = checkpoint['val_loss']
    cider = checkpoint['cider']

    return epoch, model, optimizer, lr_scheduler, train_loss, val_loss, cider