Assistant needed to solve a cryptic crror when implementing C6

I have encountered a very cryptic error. The error is rather long so I will only post part of the unit test results.

This is the traceback message.

And this is the error message.

I am completely confused with what has happened as it seems that the results from all the previous tests are passed.

It will be really helpful if I can send someone the notebook so one can have a look. Thank you very much in advance.

Hi @R_Wang

It’s hard to tell, but the problem may lie in symbol variable. The instruction hint:

    # get the next symbol by getting a logsoftmax sample (*hint: cast to an int)


I didn’t really move to that step actually, the problem lies in

output, _ = NMTAttn(()).

It is possible that I send you the code so you can have a look?

@R_Wang Sure. Send it to me I will take a look.

The unit test for next_symbol was updated on 01/19, using the Lab Help button, I got the latest version, but it still seems to be incorrect. I don’t know how many others are doing this assignment after the update. Here is my question - w1_unittest.test_next_symbol(next_symbol, NMTAttn) is passing the function NMTAttn, not the model. Where am I supposed to point it to the trained model’s weights? I am also stuck on this same problem.

To answer my own question, there is no need to initialize weights. When I initialized weights inside next_symbol method, my output didn’t match the unit test’s expectation. I was calling NMTAttn like this - NMTAttn(params). Changing it to NMTAttn((params)) fixed this issue for me.