fickaz / TFRS-on-Retail-Data

Tensorflow Recommenders with Example on Retail Data
19 stars 16 forks source link

value error while predicting the results #2

Open Chaichaithra opened 2 years ago

Chaichaithra commented 2 years ago

ValueError: Attempt to convert a value (<MapDataset shapes: (None, 32), types: tf.float32>) with an unsupported type (<class 'tensorflow.python.data.ops.dataset_ops.MapDataset'>) to a Tensor.

jmtaverne commented 2 years ago

I have the same issue.

sumit-mandal commented 2 years ago

@Chaichaithra @jmtaverne did you figure out any solution?

jeanaktas commented 2 years ago

This solutions worked for me replace : index.index(items.batch(100).map(model.item_model), items) by : index.index_from_dataset(items.batch(100).map(lambda items: (items, model.item_model(items))))

Chemchu commented 2 years ago

You saved my day. I am new to Tensorflow and I lost 4 hours trying to figure things out. Thank god I saw your comment

Chaichaithra commented 2 years ago

The below code worked for me with slight tweaking. I am sorry I do not have the original code. Hope this helps if anyone is trying TFRS. https://github.com/Chaichaithra/petrecommendation/blob/main/trs.py