Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Exception encountered when calling layer "random_flip" (type RandomFlip). #15

Open
Rudra2307 opened this issue Feb 6, 2023 · 0 comments

Comments

@Rudra2307
Copy link

2023-02-06 23:05:44.031991: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "C:\Users\rudra\OneDrive\Desktop\Projects\potato-disease-classification-main\api\main.py", line 24, in
MODEL = tf.keras.models.load_model("../saved_models/1")
File "C:\Users\rudra\OneDrive\Desktop\Projects\potato-disease-classification-main\api\env\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\rudra\OneDrive\Desktop\Projects\potato-disease-classification-main\api\env\lib\site-packages\keras\saving\legacy\saved_model\load.py", line 1015, in _unable_to_call_layer_due_to_serialization_issue
raise ValueError(
ValueError: Exception encountered when calling layer "random_flip" (type RandomFlip).

Cannot call custom layer random_flip of type <class 'keras.saving.legacy.saved_model.load.RandomFlip'>, because the call function was not serialized to the SavedModel.Please try one of the following methods to fix this issue:

(1) Implement get_config and from_config in the layer/model class, and pass the object to the custom_objects argument when loading the model. For more details, see: https://www.tensorflow.org/guide/keras/save_and_serialize

(2) Ensure that the subclassed model or layer overwrites call and not __call__. The input shape and dtype will be automatically recorded when the object is called, and used when saving. To manually specify the input shape/dtype, decorate the call function with @tf.function(input_signature=...).

Call arguments received by layer "random_flip" (type RandomFlip):
• unused_args=('tf.Tensor(shape=(None, 256, 256, 3), dtype=float32)',)
• unused_kwargs={'training': 'None'}

my libs
tensorflow 2.11.0
tensorflow-estimator 2.11.0
tensorflow-intel 2.11.0
tensorflow-io-gcs-filesystem 0.30.0
tensorflow-serving-api 2.11.0
urllib3 1.26.14
uvicorn 0.20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant