Dls course 5 week 4 exercise transformer final

Hello, this aks about 5 arguments instead of 4. It then points at my encoder mask but that takes 4 arguments. the thing I’m putting 5 arguments into is dec output. which I put in output sentence, enc output, training, look ahead mask, and padding mask. Let me know if you see anything that can point me in the right direction from this error message. Thanks

TypeError Traceback (most recent call last)
in
1 # UNIT TEST
----> 2 Transformer_test(Transformer, create_look_ahead_mask, create_padding_mask)

~/work/W4A1/public_tests.py in Transformer_test(target, create_look_ahead_mask, create_padding_mask)
276 enc_padding_mask,
277 look_ahead_mask,
→ 278 dec_padding_mask
279 )
280

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
1010 with autocast_variable.enable_auto_cast_variables(
1011 self._compute_dtype_object):
→ 1012 outputs = call_fn(inputs, *args, **kwargs)
1013
1014 if self._activity_regularizer:

in call(self, input_sentence, output_sentence, training, enc_padding_mask, look_ahead_mask, dec_padding_mask)
52 # START CODE HERE
53 # call self.encoder with the appropriate arguments to get the encoder output
—> 54 enc_output = self.encoder(input_sentence,training,look_ahead_mask,enc_padding_mask) # (batch_size, inp_seq_len, fully_connected_dim)
55
56 # call self.decoder with the appropriate arguments to get the decoder output

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
1010 with autocast_variable.enable_auto_cast_variables(
1011 self._compute_dtype_object):
→ 1012 outputs = call_fn(inputs, *args, **kwargs)
1013
1014 if self._activity_regularizer:

TypeError: call() takes 4 positional arguments but 5 were given

Your call to self.encoder() has too many mask parameters.

Check the call method of the Encoder class, from the “Exercise 5” part of the notebook.

2 Likes

Thank you! that was the problem!