C3W2_Assignment Error

Hello,
I’m working on the assignment, but there is an error occurring.

This is the output of the fit_label_encoder function :

And the test has passed :

However, when I try to complete Exercise 4: preprocess_dataset, there is an error. Here is the output:

And here is the error message:


I hope someone can help me. Thank you very much.

refer this

you are probably dividing dataset step into two steps where you are recalling each set twice, dataset need to be recalled in one single step

refer the comment link which explains how to write the code

@Deepti_Prasad
Thanks, I converted the dataset sentences to sequences and encoded the text labels in a single step.
But I found that the label and text were reversed (the shape wasn’t as expected), so I corrected it. However, something strange is happening—there’s an error in one cell, but the test is still passing.

I will show you from " Exercise 3: fit_label_encoder" step :

“Exercise 4: preprocess_dataset” Step, where I correct the shape of the data:

Thank you very much for your help.

if you have done dataset step in 1 step and still it is throwing error, then one has to go back to previous exercise where you have passed test, you can DM screenshot of the codes.

@Deepti_Prasad
I’m sorry, can you explain this part " issue is you mention that extra label, text after lambda(you don’t require to mention label and text and again use the function recall to text and labels".

sorry @JoudSaqer

your dataset codes are right, I mixed with other learner’s post query.

but in the fit_label encoder for code line

join the two label datasets

You used incorrect function to concatenate the training and validation labels.

you were suppose to use train_labels argument to concatenate to validation_labels and tf.data.Dataset, that multiplied the number of dataset in your case which was more than what was required, hence threw that error.