-
Notifications
You must be signed in to change notification settings - Fork 74.1k
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
Problem converting from saved model to tflite model #62610
Comments
Hi @NotPjoker05, Could you please fill the template to resolve the issue. Thank You |
I'm already using tensorflow 2.15. 1. System information
2. CodeHere are my 3 files, Training for training my model, utils provides a list of methods used in training and test is the class where I use my model (predictions work in tensorflow but the method for converting from saved model to tflite doesn't work) Training.txt 3. Failure after conversionWhen I try to convert my model with the code in Test class I receive this error: Please help me, I've been stuck on this error for weeks... |
@NotPjoker05 , |
Sure, this is my dataset: Thank you very much! |
Hi @NotPjoker05 , Sorry for the delay, I have executed the code in colab 2.15. It's working as expected. The saved model inference and tflite inference(both Thank You |
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. |
Same issue. Colab crash without any error.. |
Just in case it helps others like me struggling with this issue. I realized I was using TensorFlow 2.16.1 , from docker image tensorflow:latest-gpu and that was the source of the problem. |
@adamantivm Thanks for helping with my project, good idea! Solved this problem. |
Same issue. |
Same issue here. 2.16.1 crashed, 2.15 worked. |
I have the same issue on TF 2.16.1 (instead it works on 2.15 as suggested) on my local machine, when running the following script that creates a very small NN in Keras and then converts it to TFlite:
|
Hi, I'm trying to convert my model (saved in 'saved model' format) to a tflite model but I get an error, this is my code:
`converter = tf.lite.TFLiteConverter.from_saved_model('saved_model')
tflite_model = converter.convert()
with open('model.tflite', 'wb') as f:
f.write(tflite_model)`
The error is this:
loc(fused["ReadVariableOp:", "sequential_1/conv2d_1/ReadVariableOp@__inference_serving_default_285"]): error: missing attribute 'value'
LLVM ERROR: Failed to infer result type(s).
I read the tensorflow page related to the topic and it explains that a refactoring of my model is probably necessary, so I tried to follow the indication but the error I get is the same (my other code is this:)
`
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model('saved_model')
converter.target_spec.supported_ops = [
tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
`
I hope someone is able to help me, thanks in advance
The text was updated successfully, but these errors were encountered: