C4W1_Assignment Translator unit test

w1_unittest.test_translator(Translator, Encoder, Decoder)

Failed test case: Incorrect third dimension of translator output.
Expected: 16
Got: 12000

even if my code passed the quick checks and the output tensor shape matched with the expected output, it’s failing the test case. I have done the whole code according to the instructions. can anyone help?

Is your code perhaps using a hard-coded value of 12000?

1 Like

My code is not using a hard-coded value. I found my mistake and corrected it. Thanks for your response.

1 Like

Hello, can you please tell us about your mistake ? i got the same problem, it gives this error:
Failed test case: Incorrect output dim of embedding layer.
Expected: 32
Got: 512

Failed test case: Incorrect output dim of embedding layer.
Expected: 64
Got: 512

Failed test case: Incorrect output dim of embedding layer.
Expected: 256
Got: 512

i didn’t know what to put as output_dim value

Thank you

Hi @Burak_Bakkar

You probably hard coded the 512 value instead of using the units parameter.

Cheers

1 Like

Getting the exact same error as @WASIOU_JAHARABI.
Any hint on the exact error made?

Hi @Ben_Serota

You will understand the hint as you know 12000 ( your output) is size of the vocabulary where it is looking for 16 (expected) which is unit parameter.

You are probably using global variables (VOCAB_SIZE, UNITS) instead of using the local arguments (vocab_size, units) in the __init__method of Decoder class for vocab_size and units.

Regards
DP

Hi @Deepti_Prasad ,
Reviewing the code, that seems not to be the case…
Thanks for the suggestion though…
Ben

then kindly let others know where you were going wrong.

Oh I am still trying to find the mistake @Deepti_Prasad :slight_smile:

Here is the init of the Decoder, just for reference (I can delete it if it violates the rules).
(image removed by moderator as it contained grade cell codes)

kindly don’t post codes in the public posts, I guess by now you are aware about community guidelines.

you can send the code screenshot via personal DM, if you are unable to find the issue.

regards
DP

Hi @Deepti_Prasad ,

I got the same error as @WASIOU_JAHARABI . And I use the local arguments (vocab_size, units) in the __init__method of Decoder class for vocab_size and units. I have spent hours but still can’t figure out the error. Screenshot attached:

Hi @WASIOU_JAHARABI, I have exactly the same error. What was the mistake that you found? Thx

I found the error. It had to do with calling function Decoder/Encoder with “self”. Otherwise, it will take the global variables previously defined in previous unit tests.

2 Likes

Hi @Alex_Tu

you are probably passing logits with incorrect code recall as it is looking for right shifted translation shape rather than vocab_size.

places I would check first the translator, then decoder, and if both are fine, then go back one grade cell before as 12000 is vocab size.

Check if you used the correct pre_attention or post_attention.rnn, or the call( ) in the decoder.

I am sharing a similar thread comment, see that if it helps

Let me know if any confusion.

Regards
DP

Thanks DP. I already figured it out as mentioned above.

1 Like

That worked for me, thank you !