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

KerasClassifier not compatible with latest versions of Keras and TensorFlow #2465

Open
poushalimukherjee opened this issue Jul 11, 2024 · 3 comments

Comments

@poushalimukherjee
Copy link

Describe the bug
Model architectures comprising of Keras Sequential layers are throwing various error while attempting to be used with the KerasClassifier wrapper, for latest versions of Keras.

The errors seem to relate to TensorFlow Eager Execution, as well as TensorFlow V2 Behaviour. Even after trying all sorts of configuration, the errors seemingly cannot be resolved.

The ONLY way to use KerasClassifier successfully, is to use older versions of Keras ( e.g, 2.15.0 ) and TensorFlow ( e.g. 2.15.0 ).

To Reproduce
Steps to reproduce the behavior:

  1. Train any model with Keras versions 3.. ( tried with 3.3.3 )
  2. Save/Load or directly use with KerasClassifier wrapper.
  3. As per the error descriptions, try changing TensorFlow configurations as as disabling eager-execution / v2 behaviour.

Expected behavior
A model trained/saved with the latest version of Keras, should be able to be used with KerasCassifier wrapper.

System information (please complete the following information):

  • OS - Windows
  • Python version 3.11
  • ART 1.18.1
  • TensorFlow 2.16.1 / Keras 3.3.3
@zeinab2409
Copy link

one of the common error i get is ( module 'tensorflow.keras.backend' has no attribute 'placeholder')
when i trying to use the kerasclassifier wrapper as in the statment:
classifier = KerasClassifier(model=model,clip_values=(min_pixel_value, max_pixel_value),use_logits=False)
can anyone help me to resolve this error please

@jetlime
Copy link

jetlime commented Sep 11, 2024

Confirm from my side, tf and keras==2.15 shall be used.

@Subsidy2032
Copy link

@zeinab2409
I have the same issue as you did you find a solution?

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

4 participants