I have completed the Code Assignment: Building a Translation System, and all unit tests have passed. When I submit my notebook to be graded, one of the tests fails however, with the message:
Failed test case: Failed forward pass test. Expected: None, but got: ‘EncoderDecoder’ object has no attribute ‘dec’.
I have gone over my code and the hints for the EncoderDecoder multiple times, but I cannot find where I have missed something or what the dec attribute should even refer to. Is there another version where self.decoder was named self.dec? If there is anyone who could point me in the right direction that would be great.
I can add parts of the code if that helps, but wanted to leave it out for now as I was asked not to post full assignment code.
I have not gotten to PyTorch course 3 yet, but for that type of error the first thing to look for is referencing global variables from the body of your functions where this is not specifically asked for. The theory is that you’ve referenced a global object that has a definition that works with your code in the notebook, but when you run your code in the grader environment that object has a conflicting definition which is what caused that error.
Hi @paulinpaloalto and @Mubsi , thank you for your feedback. I can see how referencing a global variable would break in the grader environment, but I cannot find any function where I might have used a global variable.
Since this is the only test case that fails in the grader, I assume the breaking code is in the Encoder-Decoder class, although it uses the earlier (Decoder) code and the earlier tests might not cover this specific case. The Encoder-Decoder code is not that complicated however and I am still not able to figure out what might cause this. Any further help would be appreciated @Mubsi
I proudly hold the PyTorch for Deep Learning Professional Certificate, so, when you get tired of trying to solve this problem without revealing specific details of your code, please send me your saved notebook (via direct message only — do NOT share it here), and I will try to figure out what’s causing the issue.
If you decide to send me the notebook, please follow these steps first: save and download the notebook containing your solution, then get a fresh copy of the notebook by clicking the “Restore Original Version” button (marked by me with a green rectangle in the image below), after that, transfer your saved solution into this clean copy, run the code, and re-submit it for review again (if the issue persists, send the notebook to me).