Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropout layer error in transfer_glove_embeddings.py #14

Closed
ulisesvid opened this issue Feb 20, 2018 · 3 comments
Closed

Dropout layer error in transfer_glove_embeddings.py #14

ulisesvid opened this issue Feb 20, 2018 · 3 comments

Comments

@ulisesvid
Copy link

Hi all!

I am trying to replicate the model of transfer_glove_embeddings.py. When I try to execute the model I gel the following error:

`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
8 weights=[embedding_weights],
9 trainable=True))
---> 10 model.add(SpatialDropout1D(Dropout(0.2)))
11 model.add(Conv1D(filters=NUM_FILTERS, kernel_size=NUM_WORDS,
12 activation="relu"))

~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + 90 ' call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper

~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/layers/core.py in init(self, rate, **kwargs)
162 @interfaces.legacy_spatialdropout1d_support
163 def init(self, rate, **kwargs):
--> 164 super(SpatialDropout1D, self).init(rate, **kwargs)
165 self.input_spec = InputSpec(ndim=3)
166

~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + 90 ' call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper

~/.virtualenvs/negative-scoring/lib/python3.6/site-packages/keras/layers/core.py in init(self, rate, noise_shape, seed, **kwargs)
99 def init(self, rate, noise_shape=None, seed=None, **kwargs):
100 super(Dropout, self).init(**kwargs)
--> 101 self.rate = min(1., max(0., rate))
102 self.noise_shape = noise_shape
103 self.seed = seed

TypeError: '>' not supported between instances of 'Dropout' and 'float'`

Any ideas? thanks in advanced

@ulisesvid
Copy link
Author

Just had to remove argument Drop():
model.add(SpatialDropout1D(0.2)) instead of model.add(SpatialDropout1D(Dropout(0.2)))

@t0nghe
Copy link

t0nghe commented Jun 1, 2019

Thanks Ulises. I ran into the same problem. Indeed it says in the documentation that SpatialDropout1D only takes a rate as argument.

@AlexGriffiths
Copy link

Thank you! That was driving me mad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants