recipe-summarization icon indicating copy to clipboard operation
recipe-summarization copied to clipboard

TypeError: 'NoneType' object is not subscriptable

Open shravanksingh opened this issue 5 years ago • 4 comments

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 1. - K.cast(mask[:, :maxlend], 'float32'), 1) TypeError: 'NoneType' object is not subscriptable

shravanksingh avatar Aug 27 '18 01:08 shravanksingh

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

DerekChia avatar Dec 15 '18 03:12 DerekChia

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']    

rinush avatar Dec 19 '18 12:12 rinush

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?

cssoumyade avatar May 01 '19 13:05 cssoumyade

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']  

rinush avatar May 03 '19 18:05 rinush