Course 4 week2 model training

what is the error here and how can i solve it…this is in the training of the model course 4 week 2 of the NLP specialization

Hi @Sally_Muhammad

Could this be your mistake?

1 Like

Unfortunately no, I’ve checked but all of the dropout lines that I have are written in this way

The second parameter for the tl.dropout is shared_axes parameter.

tl.Dropout(dropout,mode) - is the wrong way, please read carefully.

1 Like

I tried it also but i still have error for the same cell

Is it exactly the same error output as in your third screenshot?

1 Like


are you sure? The error above states that Dropout layer received str for the axis parameter in forward function. That could be caused by mode passed as a second parameter, like in:

If your error is still exactly the same as in your third screenshot then you should look why the axis value is str in your case for the Dropout layer. Did you pass all the previous tests and all your outputs exactly match the expected outputs?

1 Like

Yeah it’s the same…here it is

and yes all of the previous tests are passed and the outputs are matched

I cannot recreate the error that you have.
The mistake that you made was in the CausalAttention dimensions and that does not produce the error in the screenshot but it lamentably passes all the tests.
The only way to get the exact error is to not specify the dropout mode with mode=. So, you either forgot to re-run the cell after specifying the dropout mode with mode= or did not specify the dropout mode= in other cells of this assignment where the dropout is used or I don’t know :slight_smile: