-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Added "tensorflow.keras" compatibility in "KeyedVectors.get_keras_embedding" function. #2911
Conversation
Since TensorFlow 2.0+, Keras is the part of TensorFlow library, so I added "from tensorflow.keras.layers import Embedding" as possible import to "Embedding" layer (the old way to import is allowed too) in "get_keras_embedding" function.
For the reasons listed in #2886, and in the spirit of #2873 (slim this module) & #2852 (reduce gensim surface area), I'd prefer to remove this one-line-of-recipe code from It could easily live as a utility function elsewhere, or just be part of some example code in some doc/tutorial/notebook. It's not inherent to the |
That is true, though mostly orthogonal to this PR. We want both {modernize import, move fnc elsewhere}. @andrewsapw as a user, where would you expect this function to live, were would you look for it first? |
I agree that |
Are you talking about the official tutorials, https://radimrehurek.com/gensim/auto_examples/index.html ? Or what .png, .gif files? |
If it needs a module, maybe a new ...putting it in a "example of using gensim word-vectors with Keras" wiki page, or demo-notebook, would be just as understandable/discoverable as the existing utility function. |
Since TensorFlow 2.0+, Keras is the part of TensorFlow library, so I added "from tensorflow.keras.layers import Embedding" as possible import to "Embedding" layer (the old way to import is allowed too) in "get_keras_embedding" function.
Fixes #2842 and closes #2729.