Open eirini5th opened 2 years ago
For me Python crashes when I use this line:
from tensorflow.python.framework.ops import disable_eager_execution disable_eager_execution()
and this also doesn't help:
yolo_model.compile(loss=custom_loss, optimizer=optimizer, run_eagerly=False)
Using tensorflow.keras instead of keras also doesn't help unfortunately, did you do anything additionaly to those steps described?
The Error I get is also
TypeError: Cannot convert a symbolic Keras input/output to a numpy array. This error may indicate that you're trying to pass a symbolic value to a NumPy call, which is not supported. Or, you may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model.
I am using the notebook on colab and I want to run it with TF2. However, I come across this error on calling model.fit_generator:
The problem seems to be caused by the custom loss function, since I tried using a simple dummy loss function with no errors.
The changes I've made (to no avail) are these 2:
1) to include the lines
from tensorflow.python.framework.ops import disable_eager_execution disable_eager_execution()
before creating the model. Before adding these lines I came across this error:2) to use tensorflow.keras instead of keras, after suggestions from similar github issues and stackoverflow posts.
I am also adding the custom_loss code to include a few changes I made to use TF2 instead of TF1 (basically some tf.compat.v1.* additions).