iamaaditya / VQA_Demo

Visual Question Answering Demo on pretrained model
http://iamaaditya.github.io/2016/04/visual_question_answering_demo_notebook
MIT License
242 stars 133 forks source link

ValueError: could not broadcast input array from shape (300) into shape (100) #28

Open ismailsure opened 5 years ago

ismailsure commented 5 years ago

I am not sure what the problem us being new to using keera's

Code: embedding_matrix = np.random.random((len(word_index) + 1, EMBEDDING_DIM)) for word, i in word_index.items(): embedding_vector = embeddings_index.get(word) if embedding_vector is not None:

words not found in embedding index will be all-zeros.

    embedding_matrix[i] = (embedding_vector)

embedding_layer = Embedding(len(word_index) + 1, EMBEDDING_DIM, weights=[embedding_matrix], input_length=MAX_SEQUENCE_LENGTH)

Stack Trace: [141. 243.] [ 76. 164.] [ 88. 152.] Total 27995 word vectors in Glove. Traceback (most recent call last):

File "", line 1, in runfile('C:/Users//Desktop/LSTM/SLSTM.py', wdir='C:/Users//Desktop/LSTM')

File "C:\Users\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile execfile(filename, namespace)

File "C:\Users\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users//Desktop/LSTM/SLSTM.py", line 111, in embedding_matrix[i] = (embedding_vector)

ValueError: could not broadcast input array from shape (300) into shape (100)