C4W2 Assignment NLP Transformer Summariser Error

InvalidArgumentError: Exception encountered when calling layer ‘softmax_296’ (type Softmax).

Can not understand why my model summary is giving error when all above tests are passed. It is pointing error to my NextWord function but it produced the expected output in all exercises. Kindly assist where l should look at l have been trying but l think am blurring now.

Thank you for your time.

Generally these model summary errors are due to the unit test looking for a specific set of text for the layer names.

Sometimes there is more than one way to write code that works correctly, but the unit test has only one method it is expecting you to use.

Thank you buddy for the beneficial response. So in this case what do you suggest l do, I have been going though some functions and seen to hit brick wall, but am not stopping though, am going through from start and check as well.

If you have any further advice please do so. Thank you in advance

I’m not a mentor for this course, so I don’t have any other thoughts on the issue.

Hopefully a mentor for this course will reply here.

Hi @Abiton_Padera

There are multiple probable causes for this error.

The first thing to check is the documentation for softmax. Note, that this function takes in just two arguments - input and the axis. In most cases, the axis is the default one - last one. So, probably the most often used case is just tf.keras.activations.softmax(inputs) in other words, it receives just the inputs.

The most probable place for this error should be in Exercise 1 - have your correctly computed scaled_attention_logits (which is the input for the softmax). Also, Exercise 4 the final layer uses softmax activation (which is already defined for you in Dense layer initialization and you don’t have call it here).

Let me know if any of these help.

Thank you for the guide, l have also checked my softmax input function according to documentation. Would you mind if l share the code and may have a look if you have time. It is also showing there is error on my next_word function but all expected outcomes are met, and tests passed.