Course 4 Week 1 Ex 6: ValueError

Hello,

I completely stuck with Assignment of Week 1. I made 6 exercises, but when I run the Exercise 6 I get an error:

ValueError: Number of weight elements (1) does not equal the number of sublayers (9) in: Serial_in2_out2[
Select[0,1,0,1]_in2_out4

Can I ask a mentor to check my Notebook?

Hi @mkanin

You can private message me your notebook and I can try to help.

Cheers

I am getting the same error, have you solved your problem?

I think I found my issue:

" You can feed these with this syntax to get the model outputs: model((input1, input2))"

I was missing the tuple and directly passing input1 and input2.

1 Like

@zzwcsong Thank you for the answer. I have changed this point and successfully fixed it. But I started to get the another error (Ex 6):

AssertionError: Tuple must contain an integer and a float number

Does anyone tell me where this problem could be located?

Check if you didn’t forget to convert the prediction to int as in the hint:
# get the next symbol by getting a logsoftmax sample (*hint: cast to an int)

@arvyzukai Thank you! I have fixed the error related to converting to integer and all tests passed.

May I get some assistance with the UNQ_C6 code?
I am failing test_next_symbol UNIT_TEST with the value error:
"ValueError: Number of weight elements (0) does not equal the number of sublayers (9) in: Serial_in2_out2[
Select[0,1,0,1]_in2_out4
"

I found out the source of the error. When I inspected the model.weights calculated few cells above, I received no value. After initializing the weights from the pre-trained NMTAttn model, I was able to pass that check point.
Now I am stuck at this failure:
AssertionError: Expected output: [7283, -9.929085731506348], your output: [140, -0.0002193450927734375]

Any hints? I have tried playing with the output[x,y,:] slice as well as with the logsoftmax_sample temperature. I get always the same error

getting same error as above

Found the problem. Issue was using the pre-trained model above instead of using NMTAttn which was passed in the function.