rtlee9 / recipe-summarization

Sequence to sequence recipe summarization
MIT License
136 stars 75 forks source link

TypeError: 'NoneType' object is not subscriptable #9

Open shravanksingh opened 6 years ago

shravanksingh commented 6 years ago

Hey Ryan, I am getting the following error while running the model.py code, Could you please assist? Thanks

TypeError: 'NoneType' object is not subscriptable

File "/recipe-summarization/src/train_seq2seq.py", line 96, in create_model model.add(SimpleContext(simple_context, rnn_size, name='simplecontext_1')) File "/anaconda/envs/tensorflow/lib/python3.6/site-packages/keras/models.py", line 492, in add output_tensor = layer(self.outputs[0]) File "/anaconda/envs/tensorflow/lib/python3.6/site-packages/keras/engine/topology.py", line 636, in call output_shape = self.compute_output_shape(input_shape) File "//anaconda/envs/tensorflow/lib/python3.6/site-packages/keras/layers/core.py", line 629, in compute_output_shape x = self.call(x) File "/anaconda/envs/tensorflow/lib/python3.6/site-packages/keras/layers/core.py", line 663, in call return self.function(inputs, **arguments) File "recipe-summarization/src/model.py", line 84, in simple_context

    • K.cast(mask[:, :maxlend], 'float32'), 1) TypeError: 'NoneType' object is not subscriptable
DerekChia commented 5 years ago

I got the same error as well, seems like there is an empty list some where

rinush commented 5 years ago

Go to your keras library. In layers folder open core.py. Go to class Lambda. In call method after "arguments = self.arguments" add following code:

    if (mask == None):
        mask = arguments['mask']    
cssoumyade commented 5 years ago

I am also getting the same error. @rinush would you tell me where is the particular file, you're talking about, located on the disk?

rinush commented 5 years ago

First Find your keras library on your pc.

Screenshot (490)

Open the keras folder

Screenshot (492)

Open the layers folder

Screenshot (494)

Open core.py

Screenshot (498)

Find class Lamda

Screenshot (501)

In class Lamda find call method and add the code after "arguments = self.arguments" add following code

                     if (mask == None):
                         mask = arguments['mask']