thanks for the code!
The provided glove2h5.py does not work on my machine as there are some words in the gloVe file which contain spaces and thus the code crashes when trying to convert the splitted lines to float.
The following lines should be changed:
vocab = [line[0] for line in glove_vectors]
into
vocab = [' '.join(line[0:-300]) for line in glove_vectors]
and
vectors = np.array( [[float(val) for val in line[1:]] for line in glove_vectors] ).astype(np.float32)
into
vectors = np.array( [[float(val) for val in line[-300:]] for line in glove_vectors] ).astype(np.float32)
Hi,
thanks for the code! The provided
glove2h5.py
does not work on my machine as there are some words in the gloVe file which contain spaces and thus the code crashes when trying to convert the splitted lines to float. The following lines should be changed:vocab = [line[0] for line in glove_vectors]
intovocab = [' '.join(line[0:-300]) for line in glove_vectors]
and
vectors = np.array( [[float(val) for val in line[1:]] for line in glove_vectors] ).astype(np.float32)
intovectors = np.array( [[float(val) for val in line[-300:]] for line in glove_vectors] ).astype(np.float32)