import torch


def load_glove_vectors(fname):
    """
    load pre-trained glove word embeddings from local disk file.
    :param fname: file name
    :return: glove word embeddings
    """
    with open(fname, 'r') as f:
        model = {}
        for line in f:
            line = line.split()
            word = line[0]
            embedding = torch.Tensor([float(val) for val in line[1:]])
            model[word] = embedding
    return model