You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add one more import:
from torch.nn import Parameter
At In[16] and In[17], in case you don't have the preprocessed pkl files. (guess you won't)
def loadGloveModel(gloveFile):
print "Loading Glove Model"
f = open(gloveFile,'r')
model = {}
for line in f:
splitLine = line.split()
word = splitLine[0]
embedding = np.array([float(val) for val in splitLine[1:]], dtype='f')
model[word] = embedding
print "Done.",len(model)," words loaded!"
return model
add one more import:
from torch.nn import Parameter
At In[16] and In[17], in case you don't have the preprocessed pkl files. (guess you won't)
def loadGloveModel(gloveFile):
print "Loading Glove Model"
f = open(gloveFile,'r')
model = {}
for line in f:
splitLine = line.split()
word = splitLine[0]
embedding = np.array([float(val) for val in splitLine[1:]], dtype='f')
model[word] = embedding
print "Done.",len(model)," words loaded!"
return model
gloveFile='./datasets/nlp/glove.6B.100d.txt'
en_w2v = loadGloveModel(gloveFile)
dim_en_vec = 100
n_en_vec = len(en_w2v)
The text was updated successfully, but these errors were encountered: