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

Error with load_embeddings.py "can't fix" #13

Open
HussainYa opened this issue Feb 21, 2020 · 4 comments
Open

Error with load_embeddings.py "can't fix" #13

HussainYa opened this issue Feb 21, 2020 · 4 comments

Comments

@HussainYa
Copy link

Kindly, help me to solve the problem with this error which I receive when doing the steps to run
python -m model.pretraining.sentiment2017

File "/utils/load_embeddings.py", line 93, in load_word_vectors
embeddings = numpy.array(embeddings, dtype=numpy.float32)
ValueError: setting an array element with a sequence.

Thanks

@HussainYa
Copy link
Author

for the embedding am using ntua_twitter_300.txt.

"embeddings_file": "ntua_twitter_300"

@HussainYa
Copy link
Author

HussainYa commented Feb 21, 2020

$ python -m model.pretraining.sentiment2017
Running on:cpu
loading word embeddings...
Didn't find embeddings cache file ntua/embeddings/ntua_twitter_300.txt
Indexing file ntua/embeddings/ntua_twitter_300.txt ...
{300, 310}
Found 804871 word vectors.
Traceback (most recent call last):
File "opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec)
File "opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals)
File "ntua/model/pretraining/sentiment2017.py", line 41, in monitor="val", label_transformer=transformer)
File "ntua/utils/train.py", line 276, in define_trainer word2idx, idx2word, embeddings = load_embeddings(_config)
File "ntua/utils/train.py", line 109, in load_embeddings return load_word_vectors(word_vectors, word_vectors_size)
File "ntua/utils/load_embeddings.py", line 93, in load_word_vectors embeddings = numpy.array(embeddings, dtype='float32')
ValueError: setting an array element with a sequence.

@dennis287
Copy link

Is there a fix for this? I am currently facing exactly the same issue.

Thanks a lot!

@dennis287
Copy link

I found out the problem myself. The reason why I got this error was because of the fact that I was using a newer version of numpy than v1.13.1, which is listed in requirements.txt. I hope this helps!

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