Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate.ipynb =>> load_array in load_glove doesn't work! #218

Open
Harsh2040 opened this issue Jun 6, 2018 · 0 comments
Open

Translate.ipynb =>> load_array in load_glove doesn't work! #218

Harsh2040 opened this issue Jun 6, 2018 · 0 comments

Comments

@Harsh2040
Copy link

FileNotFoundError: [Errno 2] No such file or directory: [path to the file]/meta/sizes

Hi, I was struggling to generate the glove.dat file from glove.txt file but I found that one function in the utils2.py is missing which is get_glove.

if you are facing the above problem while running the translate.ipynb file you can add the get_glove function in the utils2.py which I have provided below and call get_glove function before load_glove function.

def get_glove(name, path, res_path):
    with open(path+ 'glove.' + name + '.txt', 'r', encoding='utf8') as f: lines = [line.split() for line in f]
    words = [d[0] for d in lines]
    vecs = np.stack(np.array(d[1:], dtype=np.float32) for d in lines)
    wordidx = {o:i for i,o in enumerate(words)}
    save_array(res_path+name+'.dat', vecs)
    pickle.dump(words, open(res_path+name+'_words.pkl','wb'))
    pickle.dump(wordidx, open(res_path+name+'_idx.pkl','wb'))
dineshkumarsarangapani pushed a commit to dineshkumarsarangapani/courses that referenced this issue Sep 29, 2018
Make the assertion less restrictive + add some docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant