How to call predict() in eager mode (tf1 and tf2 compatibility issues)

I’m trying to perform an adversarial attack using [this demo] on my detection model created with tensorflow/keras. The problem is that the script I’m trying to use was written with TF1 in mind, whereas I’ve created my model with TF2.

When I feed my model into the script I’m seeing the following error:

ValueError: Calling `Model.predict` in graph mode is not supported when the `Model` instance was constructed with eager mode enabled. Please construct your `Model` instance in graph mode or call `Model.predict` with eager mode enabled.

I’ve already learned that this is because different TF versions used different modes by default. Could you give me a tip on what can I do to convert my model to the fitting mode?

submitted by /u/Piotrek1
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *