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

Python 3 issue fix - dict_values does not support indexing #8

Open
Barqawiz opened this issue Feb 26, 2018 · 2 comments
Open

Python 3 issue fix - dict_values does not support indexing #8

Barqawiz opened this issue Feb 26, 2018 · 2 comments

Comments

@Barqawiz
Copy link

There is an issue with calling following code in Python 3+:
self.embeddings_index.values()[0]

Reason
In Python 3, dict.values() does not return list and following error will be raised:

dict_values does not support indexing

Solution
The line should be updated in python 3+ as following
list(self.embeddings_index.values())[0].shape[-1]
In following files:

  • token_model.py
  • embeddings.py
@Barqawiz Barqawiz changed the title Python 3 issue - dict_values does not support indexing Python 3 issue fix - dict_values does not support indexing Feb 27, 2018
@ebuildy
Copy link

ebuildy commented Jun 19, 2018

Feel free to propose a PR!

@rjczanikcorp
Copy link

rjczanikcorp commented Jan 8, 2019

This still gives an error for the sentence_model.py:

---> 37 self.embeddings_index = get_embeddings_index(embedding_type)

TypeError: 'dict_values' object does not support indexing

It is not clear where exactly in token_model.py and embeddins.py the correction should be applied.

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

3 participants