C3W3 Assignment padding problem

I am trying to do C3W3 assşgnment but in seq_pad_and_trunc function I get the following error.

TypeError                                 Traceback (most recent call last)
<ipython-input-50-934f9fde7150> in <module>
      1 # Test your function
----> 2 train_pad_trunc_seq = seq_pad_and_trunc(train_sentences, tokenizer, PADDING, TRUNCATING, maxlen=16)
      3 val_pad_trunc_seq = seq_pad_and_trunc(val_sentences, tokenizer, PADDING, TRUNCATING, MAXLEN)
      4 
      5 print(f"Padded and truncated training sequences have shape: {train_pad_trunc_seq.shape}\n")

<ipython-input-47-1ad2379829b0> in seq_pad_and_trunc(sentences, tokenizer, padding, truncating, maxlen)
     16 
     17     # Convert sentences to sequences
---> 18     sequences = tokenizer.texts_to_sequences(sentences)
     19 
     20     # Pad the sequences using the correct padding, truncating and maxlen

/opt/conda/lib/python3.8/site-packages/keras_preprocessing/text.py in texts_to_sequences(self, texts)
    279             A list of sequences.
    280         """
--> 281         return list(self.texts_to_sequences_generator(texts))
    282 
    283     def texts_to_sequences_generator(self, texts):

/opt/conda/lib/python3.8/site-packages/keras_preprocessing/text.py in texts_to_sequences_generator(self, texts)
    315                 i = self.word_index.get(w)
    316                 if i is not None:
--> 317                     if num_words and i >= num_words:
    318                         if oov_token_index is not None:
    319                             vect.append(oov_token_index)

TypeError: '>=' not supported between instances of 'int' and 'tuple'

All my previous expected outputs are correct. What am I doing wrong to get this error?

The error clearly tells you that you comparison >= is between an int and a tuple, you either need to have both as ints (most probable) or tuples. You are probably required to choose one of the elements of the tuple for the comparison!

The problem is that I am doing everything that the assignment tells me to do. All the check points are correct. All the previous function outputs are in match with expected outputs. The function that gives this error is padding function of tensorflow which I am feeding list of sentences.

How did you solve C3W3 assignment, decoder part I am not able to figure out the solution.

I got this type of error. Would you help to figure out the solution?

This error is because when you build the encoder and decoder you are not cropping probably as you should, I think.

At this point I would suggest you go back and have a careful look on those exercises again.