-
Notifications
You must be signed in to change notification settings - Fork 108
AttributeError: 'KerasTensor' object has no attribute 'graph' #651
Comments
Having the same issue too with keras version 2.4.3 and python 3.8.5 |
I was only able to export the model after I saved it and used the tf2onnx command line tool. |
did it start to occur on tf 2.4.x or 2.5.x? |
I'm not sure if this helps, but I was able to run the conversion when I removed a data augmentation layer: |
I do have a data augmentation layer!
I'll try removing this when I get back to the machine I created it on and see if that makes a difference. |
hey i also get this error with this code:
The error:
|
Having the same issue with tf 2.4.0, keras 2.4.3, and keras2onnx 1.7.0. |
I had the same problem. I resolved the issue by uninstalling tf 2.4.0 and installing tf 2.2.0. |
face same problem too..Please fix this as soon as possible. |
Same problem here with tensorflow 2.4 |
@EMichaelC I have successfully used such a workaround: downgrading from TF 2.4.0 to TF 2.3.1 did the trick. Keep in mind that both ONNX and SHAP share the same problem (shap/shap#1694). Possibly, TF's team has recently changed something in their API. Therefore ONNX and SHAP will have some delays in trying to keep up with TF's changes. The configuration that worked for me: |
I'm having the same problem. Dowgrading tensforflow to 2.2.0 or 2.3.1 does not fix the issue. Did anyone manage to solve it? |
In fact, when I downgrade to 2.3.1 the error is not anymore when I try to convert the model, but when I try to save the model:
Any idea? |
changed the configuration to- |
I do have the same issue. Is there any update on this? |
I have the same issue, is there going to be a fix soon? Thanks! |
I'm too |
I met the same issue (TF 2.4.0, python 3.7.10, keras2onnx 1.7.0 ), my colleague solved the problem in this way:
then the model can be converted successfully! Hope this help 😄 |
Also running into this same issue. python 3.6.5 Tried to downgrade tensorflow to 2.2.0, but pip complains: ERROR: No matching distribution found for tensorflow==2.2.0 Any suggestions on a workaround? |
getting same error in
Any help is much appreciated |
I managed to transform an H5 Keras model to an ONNX model via tf2onnx. Here is my code: import tensorflow as tf
import onnx
import tf2onnx.convert
with open('model.json') as f:
model_json = f.read()
model = tf.keras.models.model_from_json(model_json)
model.load_weights('model.h5'))
onnx_model, _ = tf2onnx.convert.from_keras(model)
onnx.save(onnx_model, 'model.onnx') By the way, this issue seems to be one of most encountered issue, as per the number of similar issues (#662, #683, #724). |
The former is incompatible with Tensorflow 2.4+ [1] [1] onnx/keras-onnx#651
Thank you @yan12125, that worked for me! |
Thank you @yan12125, that worked perfect for me in python==3.9.5, tensorflow==2.5.0, keras2onnx==1.7.0, onnxruntime==1.8.0, |
Thanks @cocoyen1995 ! |
It has been almost two months since the post stating the fix has been merged. It is still a problem. I did an install on July 29 and still get the same error. |
I'm getting a strange error from onnxruntime Below code works perfect in standalone (python==3.9.5, tensorflow==2.5.0, keras2onnx==1.7.0, onnxruntime==1.8.0,
Same code inside Flask App, InferenceSession throws error
I am mainly after input_name
Is there a way to extract the "input_name" or solve this error |
For getting input_name
above works, |
issue solved with
|
Basically I tried following this Transfer Learning tutorial . I made minor adjustments like used the Stanford Dog Breed dataset and used softmax in the final layer instead of sigmoid. Everything works fine until I try exporting the model using keras2onnx.
import keras2onnx import onnxruntime onnx_model = keras2onnx.convert_keras(model, model.name)
I get the following errors:
The text was updated successfully, but these errors were encountered: