Transformer C8 AssertionError: Wrong values in translation

Although I went through many similar error post here, but the solution mentioned in those was still very unclear. So I am posting screenshot of my error here. Please guide me through.

as mentioned by one of the mentor, which I followed I understood, enc_padding_mask should not be added to encoder output. so that corrected my enc_ouput error.

but the error for decoder is where I am stuck where I believe my input code might be not correct which is causing value error, or if it is the positional coding error???

also after the dec_output, I saw this line mentioned but only final_output was mentioned, but in the bracket it shows 2 lines code. So wanted to know am I missing any part of coding…

pass decoder output through a linear layer and softmax (~2 lines)

thank you

Please click my name and message your notebook as an attachment.

I have mailed you my notebook sir

Hi @Deepti_Prasad,

You are passing the wrong masks for enc_output and dec_output .

Please take a look at the variable names I mentioned above and try to figure out which masks need to be passed.


1 Like

thank you so much. why and where I got confused.

the below line confused me in def
enc_padding_mask – Boolean mask to ensure that the padding is not
treated as part of the input

so I thought we are not suppose to add it in enc_output.

I was really not understanding the instruction properly. actually I had use the same code but that time my output code was not right, so I kept changing to find solution.

Thank you again

sir @Mubsi sir guided me with the issue. My codes were not right which is now corrected.

Thank you

Hi @Mubsi , I believe I am passing the right masks for encoder and decoder, but I also encounter this issue.

Please ignore, found my error