jph00 / part2 Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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)
Hi,
def load_glove(loc):
return (bcolz.open(loc+'.dat')[:],
pickle.load(open(loc+'_words.pkl','rb'), encoding='latin1'),
pickle.load(open(loc+'_idx.pkl','rb'), encoding='latin1'))
en_vecs, en_wv_word, en_wv_idx = load_glove('/data/datasets/nlp/glove/results/6B.100d')
en_w2v = {w: en_vecs[en_wv_idx[w]] for w in en_wv_word}
n_en_vec, dim_en_vec = en_vecs.shape
I can't find 6B.100d_words.pkl, 6B.100d_idx.pkl where https://nlp.stanford.edu/projects/glove/. Can you tell download them from where, thanks.
I am modifying bits of the code so that it works with keras 2. Would you be interested in PRs?
Hi, Jeremy,
In the lesson 1, the vgg16.py has a extra Lambda layer for the vgg_preprocess which minus the rgb mean and revert the RGB to BGR. Do we still need the color RGB preprocess with the new vgg16 in this repo?
Thanks
tjliupeng
Hey, what's up?
Thanks so much for uploading the code.
regarding this line:
def Var(*sz): return Parameter(Arr(*sz)).cuda()
I believe cudaing this decoder parameters is redundant as we are cudaing the decoder later on in the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.