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

how to use pre-trained word embedding #49

Open
xiaotongshi opened this issue Sep 2, 2019 · 0 comments
Open

how to use pre-trained word embedding #49

xiaotongshi opened this issue Sep 2, 2019 · 0 comments

Comments

@xiaotongshi
Copy link

xiaotongshi commented Sep 2, 2019

model = Sequential()
model.add(Embedding(vocab_size, VOCAB_REP_DIM, input_length=WINDOW_SIZE, weights=[embedding_matrix]))
model.add(Bidirectional(LSTM(HIDDEN_DIM, return_sequences=True)))
model.add(AttentionDecoder(HIDDEN_DIM, vocab_size))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['acc'])
model.summary()

I would like to use pre-trained word2vec embedding.
vocab_size = 149
VOCAB_REP_DIM = 100
WINDOW_SIZE = 10

But I got this error
ValueError: Error when checking input: expected embedding_1_input to have 2 dimensions, but got array with shape (152548, 10, 149)

Anyone know how to use pre-trained word embedding here?
Thanks in advance

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

1 participant