Error in Grading: Details:\nname 'text_vectorization' is not defined #C3W3


I completed the assignment C3W3: Question Duplicates and it passes the tests, but when evaluating it, I got this error in train the model:

There was an error grading your submission. Details:\nname ‘text_vectorization’ is not defined

But it is defined, and the training works fine. The following is the training output:

Anyone had this error before?

Hi @User705

I notice that your loss is way too high, so maybe the reason lies in your previous exercises (even though the error for grading is strange but it might have been caused by mistakes in your code and unit test did not capture them).

Let me know if you resolved your issue.

I fixed it and here is the updated output:

Epoch 1/2
349/349 [==============================] - 34s 85ms/step - loss: 43.9562 - val_loss: 16.3442
Epoch 2/2
349/349 [==============================] - 9s 25ms/step - loss: 11.3084 - val_loss: 10.5432

But I am still stuck at the same issue.

Hi arvy, based on his error, not defined for text vectorisation could be because he has not used the tf.keras.layers.TextVectorisation() for the exercise cell where sentence_vectorize is defined???

That can be issue right?

I did use it, and it passed the earlier tests


okay, sorry use705 I was asking arvy as I am not mentor for this course but a learner for this course right now.

Can you share the image of the error you are getting. Sorry I am not Mentor for this specialisation that’s why I was asking arvy, the NLP mentor.

Even I am doing the updated NLP course right now and I possibly noticed another post thread having similar issue, probably you can try once the search tool.

When I was asking arvy about the issue being related to sentence vectorizer, I meant it could be interconnected with that or from the create model grader cell. Actually until I see the error being shown, I honestly cannot say what could be the issue. Probably arvy is the expert here who would be better at cracking the issue.


Hi @User705

The reason for your error is that you are trying to use text_vectorization variable inside the train_model() function of Exercise 03 - which is not defined. The parameter for this function is text_vectorizer (note the difference of last characters).


1 Like