avisingh599 / visual-qa

[Reimplementation Antol et al 2015] Keras-based LSTM/CNN models for Visual Question Answering
https://avisingh599.github.io/deeplearning/visual-qa/
MIT License
480 stars 186 forks source link

input_dim has multiple values? #6

Closed arushk1 closed 9 years ago

arushk1 commented 9 years ago

$ python trainMLP.py loaded vgg features loaded word2vec features... Traceback (most recent call last): File "trainMLP.py", line 114, in main() File "trainMLP.py", line 62, in main model.add(Dense(args.num_hidden_units, input_dim=img_dim+word_vec_dim, init='uniform')) TypeError: init() got multiple values for keyword argument 'input_dim'

Not able to understand this. Seems fine to me. This is the way I'd do it. Insights?

avisingh599 commented 9 years ago

You got this error without making any changes to the script?

arushk1 commented 9 years ago

Yes. No changes at all

avisingh599 commented 9 years ago

I'm unable to reproduce this error on my side. Are you using the same versions of Keras/Theano as I have highlighted in my README? Try this simple Keras example:

from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD

model = Sequential()
# Dense(64) is a fully-connected layer with 64 hidden units.
# in the first layer, you must specify the expected input data shape:
# here, 20-dimensional vectors.
model.add(Dense(64, input_dim=20, init='uniform'))
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(64, init='uniform'))
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(2, init='uniform'))
model.add(Activation('softmax'))

sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='mean_squared_error', optimizer=sgd)

This is straight from the Keras README.

arushk1 commented 9 years ago

Yeah. This does not run. That's odd. I have used keras before... Let me check

arushk1 commented 9 years ago

Yeah. It was a Keras problem. Someone had opened the same issue on Keras repo. Fixed now.