keras_to_tensorflow icon indicating copy to clipboard operation
keras_to_tensorflow copied to clipboard

TypeError: '<' not supported between instances of 'dict' and 'float' in pickle.load(f)

Open atifrizwan91 opened this issue 1 year ago • 0 comments

Environment Details: Python Version: 3.7 TensorFlow Version: 2.9

Problem: I am encountering a TypeError when attempting to unpickle a TensorFlow model that was previously saved using the pickle module. The model was pickled and is being unpickled in the same environment (Python 3.7, TensorFlow 2.9).

Code to Save the Model:

import pickle

with open('trained_height_map.pkl', 'wb') as f:
    pickle.dump(autoencoder, f)

Code to Load the Model:

with open('trained_height_map.pkl', 'rb') as f:
    autoencoder = pickle.load(f)

Error Encountered:

TypeError: '<' not supported between instances of 'dict' and 'float'

The error occurs specifically on the line where I try to load the model using pickle.load(f).

I would appreciate any insights or suggestions on how to resolve this error. Is there a known compatibility issue with TensorFlow models and pickle in this environment, or could there be something specific about the model that is causing this issue?

atifrizwan91 avatar Dec 07 '23 16:12 atifrizwan91