transcranial / keras-js

Run Keras models in the browser, with GPU support using WebGL
https://transcranial.github.io/keras-js
MIT License
4.96k stars 503 forks source link

Model outputs NaN #130

Closed zhuoli7 closed 6 years ago

zhuoli7 commented 6 years ago

I have this following model:

model = Sequential()
model.add(Embedding(7551, 300, input_length = 200, mask_zero = True, weights = [embmat_300], trainable=False))
model.add(Bidirectional(LSTM(32, dropout = 0.2, recurrent_dropout = 0.2)))
model.add(Dense(2, activation = 'sigmoid'))
model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy'])

And the output of this model is something like this: Float32Array(2) [NaN, NaN] Any idea of what's wrong? Any help would be appreciated.

zhuoli7 commented 6 years ago

Problem solved by setting gpu: true