Course 3 Week 4 Assignment Test Error

Here is my definition to create n_grams:
Grade cell codes removed as it is against community guidelines and violation of Code of Conduct. One can share codes by personal DM when mentor wants to look at your codes

And I have been struggling for the whole weekend trying to figure out why I am receiving this error:

AttributeError Traceback (most recent call last)
Cell In[150], line 2
1 # Test your code!
----> 2 unittests.test_n_gram_seqs(n_gram_seqs)

File /tf/unittests.py:228, in test_n_gram_seqs(learner_func)
224 cases.append(t)
226 return cases
→ 228 cases = g()
229 print_feedback(cases)

File /tf/unittests.py:215, in test_n_gram_seqs..g()
212 t.got = f"Size is: {len(learner_output)}"
213 cases.append(t)
→ 215 learner_set = set([frozenset(list(x.numpy())) for x in learner_output])
216 expected_set = set([frozenset(list(x.numpy())) for x in t_case[“expected”]])
218 t = test_case()

File /tf/unittests.py:215, in (.0)
212 t.got = f"Size is: {len(learner_output)}"
213 cases.append(t)
→ 215 learner_set = set([frozenset(list(x.numpy())) for x in learner_output])
216 expected_set = set([frozenset(list(x.numpy())) for x in t_case[“expected”]])
218 t = test_case()

AttributeError: ‘numpy.ndarray’ object has no attribute ‘numpy’

when trying to pass the unittests.test_n_gram_seqs(n_gram_seqs)

If I continue on with the assignment, every other test passes, and I can even train the model.

hi @jc0s

Kindly avoid posting codes correct or correct as it’s against community guidelines.

That error is being thrown because you are not suppose to use numpy function when you create the sequence list of line using vectorizer function.

Regards
DP