import torch


def _load_model_from_state_dict(model, fname):
    """Load trained model based on instance and path to state dictionary.
    """
    state_dict = torch.load(fname, map_location={'cuda:0': 'cpu'})
    model.load_state_dict(state_dict)
    return model