I have successfully trained a model using pytorch dataloaders and keras 3.0 api. However I run into this error TypeError: 'TensorSpec' object is not iterable
when I run model.predict(data)
where data
is a pytorch dataloader containing only features with no labels.
Hi @Atia, I don’t think you can able to pass the dataloader directly to the model.predict
you have to iterate through the dataloader and can pass the values to the predict method. Please refer to this gist for working code example. Thank You.
Thanks for the reply. However if I have a lot of image data with large image sizes, I believe this method could lead to memory running out since I have to read them all into a numpy array. I will explore another approach and hopefully share that as well.