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

Loading a pre-trained word embedding model #165

Open
isegura opened this issue Oct 24, 2018 · 1 comment
Open

Loading a pre-trained word embedding model #165

isegura opened this issue Oct 24, 2018 · 1 comment

Comments

@isegura
Copy link

isegura commented Oct 24, 2018

Thanks for this tool for multi-label classification!!!

I would like to use a pre-trained word embedding model (such as GoogleNews-vectors-negative300.bin or wikipedia-pubmed-and-PMC-w2v.bin).

I have created a Magpie object indicating the path that contains this pre-trained word embedding model, for example:
magpie=Magpie(word2vec_model='models/embeddings/GoogleNews-vectors-negative300.bin')

However, I gets the following error:
UnpicklingError: invalid load key, '3'.

Please, could you help me?.
Thanks, Thanks, Thanks!!!

@rajeshkumargp
Copy link

rajeshkumargp commented Dec 26, 2018

@isegura Try using this

from gensim.test.utils import datapath
wv_from_bin = KeyedVectors.load_word2vec_format(datapath("euclidean_vectors.bin"), binary=True)

word2vec_model = wv_from_bin
magpie=Magpie(word2vec_model=word2vec_model)

Refer https://radimrehurek.com/gensim/models/keyedvectors.html#module-gensim.models.keyedvectors

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

2 participants