ValueError: Layer weight shape (1000, 10) not compatible with provided weight shape (2097, 50)

Hello!

I get the following error message when I try to put my GloVe embeddings into a neural network:
ValueError: Layer weight shape (1000, 10) not compatible with provided weight shape (2097, 50)

Can you help me?
My code is below:

tokens = word_tokenizer(model_data$text)
v = create_vocabulary(itoken(tokens))
v = prune_vocabulary(v, term_count_min = 5, doc_proportion_max = 0.5)
it = itoken(tokens)
vectorizer = vocab_vectorizer(v)

dtm = create_dtm(it, vectorizer)
tcm = create_tcm(it, vectorizer, skip_grams_window = 5)
glove_model = GloVe$new(rank = 50, x_max = 10)
wv = glove_model$fit_transform(tcm, n_iter = 5)

wv <- wv + t(glove_model$components)

input <- layer_input(shape=c(1), dtype="string")

output <- input %>%
layer_embedding(input_dim = num_words, output_dim = 10, input_length = 60, weights=list(wv), trainable = FALSE) %>%
layer_global_average_pooling_1d() %>%
layer_dense(units=10, activation="relu") %>%
layer_dropout(0.5) %>%
layer_dense(units=1, activation="sigmoid")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.