C3W3 Assignment: Exploring Overfitting in NLP

I get the following error even though my preceding code gives the correct batch sizes for training and validation in Exercise 1: train_val_datasets. The error seems to refer to a variable in the unittest. I don’t know what to do now.

UnboundLocalError Traceback (most recent call last)
Cell In[8], line 2
1 # Test your code!
----> 2 unittests.test_train_val_datasets(train_val_datasets)

File /tf/unittests.py:168, in test_train_val_datasets(learner_func)
164 cases.append(t)
166 return cases
→ 168 cases = g()
169 print_feedback(cases)

File /tf/unittests.py:90, in test_train_val_datasets..g()
87 return [t]
89 t = test_case()
—> 90 if not isinstance(validation_text, tf.Tensor):
91 t.failed = True
92 t.msg = “Incorrect output type for validation texts”

UnboundLocalError: cannot access local variable ‘validation_text’ where it is not associated with a value

Please look at the starter code (refresh your workspace if required). While the grader is okay with function local variables, no variables should be renamed / introduced at the global notebook scope.

If this is not your case, click my name and message your notebook as an attachment.

1 Like

No variables were renamed. Fixed the problem.

OK fixed the problem myself. I guess with enough time the solution appears! Thanks

1 Like