Ok, it turns out that Tom was right on the money with that theory. The bug was that in the model
function (UNQ_C2), the logic does not call sentence_to_avg
, but just reimplements the “guts” of it. But does it in a way that omits one critical piece: the handling of the case that the sentence contains a word that is not in the embedding dictionary.
So the grader is probing model
with a test case that hits that situation and “Kaboom!” The only question now is whether there is a reasonable way to either 1) upgrade the test in the notebook to catch that error in model
or 2) update the grader test case to fail in a more helpful way.
I’ll think about option 1), since the course staff seem to be pretty reluctant to change grader code.