Week 3, C3W3_Assignment in section 4-5, classify and evaluate, How to pass the tf.data.Dataset.from_tensor_slices output to model, to get the prediction

sequence-models-in-nlp/programming/jjKpq/question-duplicates

hi @Shashank_Kate

Kindly post the issue you are encountering while trying to pass grade cell in question.

You can share screenshot of the error if you have encountered or the different output to the expected output here.

Please make sure not to post any grade cell codes here as it is against community guidelines.

Regards
DP

test_gen = tf.data.Dataset.from_tensor_slices(((test_Q1, test_Q2),None)).batch(batch_size=batch_size)

START CODE HERE

pred = None

This section requires to get the predictions from the model, but no loop is used so I need to understand how I need to get the predictions

Did you check the call arguments for the grade cell? what does it show??

There is nothing I can see regarding this call to get prediction.

there are some assigned arguments for this grade cell, that’s for sure I remember.

the test_gen is data given to you, to get the pred, but you are suppose to use correct assigned arguments.

No loop is required. the grade cell already has model and predict arguments, use this two arguments correctly to get the pred.

Extra hint: you must have used the same function recall in the week 2 assignment to get model output from the sentence_vectorized.

Regards
DP

Expand_dims is not working, no way adapt can be applied, nothing else i can see in week2 assignment related to sentence_vectorized

You asked about pred first. now you are asking a different query.

please be specific about your issue. You aren’t suppose to use expand_dim at all to get pred. You are referring the week 2 first grade cell codes but

check what I mentioned in my previous comment? I stated to get model output using the sentence_vectorized? when did you use this code to get model output? not where we try to convert IDs to tensor, check the grade cell where you predict word. go through the Assignments carefully.

or refer the below link where arvy mention the same function you need to use to get pred using test_gen

Yes, I am asking about Pred only, that how should I get the pred, from test_gen…
I didnt get the Hint you gave above.

ok I give up, use model.predict( ) to get the pred using test_gen