C3W3 - Assignment - Error on fit

I keep getting errors in the model fit.
Till the model all output correspond but once i try to fit the model i get strange errors that report me back.

ValueError: Layer embedding_1 weight shape (128294, 100) is not compatible with provided weight shape (128295, 100).

i think it come from here

grader-required-cell

Initialize an empty numpy array with the appropriate size

EMBEDDINGS_MATRIX = np.zeros((VOCAB_SIZE+1, EMBEDDING_DIM))

Iterate all of the words in the vocabulary and if the vector representation for

each word exists within GloVe’s representations, save it in the EMBEDDINGS_MATRIX array

for word, i in word_index.items():
embedding_vector = GLOVE_EMBEDDINGS.get(word)
if embedding_vector is not None:
EMBEDDINGS_MATRIX[i] = embedding_vector

print(“Shape of EMBEDDINGS_MATRIX:”, EMBEDDINGS_MATRIX.shape)
print(“VOCAB_SIZE:”, VOCAB_SIZE)

Shape of EMBEDDINGS_MATRIX: (128295, 100)
VOCAB_SIZE: 128294

I need some help.

Tnks

1 Like

If you notice your error, your shape differ with one numerical

so for the below step
This is how you need to set the Embedding layer when using pre-trained embeddings
check if your vocab size code is recalled correctly.

Also if you have included weights with correct code for the same layer?

In the code we assign +1 and there is an explanation.
All output til there are correct.

At the model all block… And if i go back and change than +1 i get another error.

Can i pass u the notebook and i give me an hint ?

you can send me via personal DM. Share only the codes where you created your model.

Your error is telling your weight shape is mismatching. so in the embedding layer for weights what code did you put?

Regards
DP