I'm looking for a solution to my issue, and I tried several suggestions with no success. I hope someone can help me with this.
I used Autokeras to train and save a model. I used the following code to save the best model.
try:
model.save("model_autokeras", save_format="tf")
except Exception:
model.save("model_autokeras.h5")
It was saved as tf (a folder).
I loaded the model and tried to predict the target using a new CSV file.
I imported the CSV with pandas (read_csv), the file hasn't the target attribute (the one I one to predict), and loaded the model with this code:
loaded_model = load_model("model_autokeras", custom_objects=ak.CUSTOM_OBJECTS)
I tried to use the model to predict the target with this code:
predicted = loaded_model.predict(df_from_csv_file)
And I got this error:
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)
The df_from_csv_file dtypes are: "int64, int64, int64, int64, int64, object, object"
Transforming the objects to strings didn't solve the problem. Transform int64 to int32, float32, or float64 also didn't work. I also tried to use a numpy arrays with no success.
Any suggestion on how to make this work?
Thank you so much!