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

KeyedVectors.get_embedding_layer(train_embeddings = False) returns a trainable Embedding layer. #1557

Closed
vrmpx opened this issue Sep 1, 2017 · 2 comments
Labels
bug Issue described a bug

Comments

@vrmpx
Copy link

vrmpx commented Sep 1, 2017

Description

KeyedVectors.get_embedding_layer does not set trainable when returning the Keras Embedding layer.

Steps/Code/Corpus to Reproduce

from gensim.models.keyedvectors import KeyedVectors

embeddings = KeyedVectors.load_word2vec_format("GoogleNews-vectors-negative300.bin", binary = True)
embedding_layer = embeddings.get_embedding_layer(train_embeddings=False)
print(embedding_layer.trainable)

Expected Results

False

Actual Results

True

Versions

Linux-4.4.0-93-generic-x86_64-with-debian-stretch-sid
Python 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
NumPy 1.13.1
SciPy 0.19.1
gensim 2.3.0
FAST_VERSION 2

@zsef123
Copy link
Contributor

zsef123 commented Sep 1, 2017

keyedvectors.py : 835

layer = Embedding(input_dim=weights.shape[0], output_dim=weights.shape[1], weights=[weights])

get_embedding_layer function is not use train_embeddings parameter

@piskvorky piskvorky added the bug Issue described a bug label Sep 1, 2017
@menshikh-iv
Copy link
Contributor

Fixed in #1558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue described a bug
Projects
None yet
Development

No branches or pull requests

4 participants