When I try to convert it using TFLiteConverter.from_keras_model() it shows this message:
W0000 00:00:1720784699.493145 16596 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
W0000 00:00:1720784699.493345 16596 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
2024-07-12 12:44:59.496116: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: C:\Users\fortu\AppData\Local\Temp\tmpkx2rwx8u
2024-07-12 12:44:59.500208: I tensorflow/cc/saved_model/reader.cc:51] Reading meta graph with tags { serve }
2024-07-12 12:44:59.500407: I tensorflow/cc/saved_model/reader.cc:146] Reading SavedModel debug info (if present) from: C:\Users\fortu\AppData\Local\Temp\tmpkx2rwx8u
2024-07-12 12:44:59.538953: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
2024-07-12 12:44:59.543003: I tensorflow/cc/saved_model/loader.cc:234] Restoring SavedModel bundle.
2024-07-12 12:44:59.806929: I tensorflow/cc/saved_model/loader.cc:218] Running initialization op on SavedModel bundle at path: C:\Users\fortu\AppData\Local\Temp\tmpkx2rwx8u
2024-07-12 12:44:59.860358: I tensorflow/cc/saved_model/loader.cc:317] SavedModel load for tags { serve }; Status: success: OK. Took 364273 microseconds.
2024-07-12 12:44:59.933146: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:268] disabling MLIR crash reproducer, set env var MLIR_CRASH_REPRODUCER_DIRECTORY to enable.
loc(fused["ReadVariableOp:", callsite("sequential_1/conv2d_1/Reshape/ReadVariableOp@__inference_serving_default_253"("c:\Users\fortu\Desktop\TFC\convertToLite.py":13:1) at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1175:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1129:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1636:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1614:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\convert_phase.py":205:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1537:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\layer.py":58:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\layer.py":120:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\layers\layer.py":882:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\operation.py":46:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":156:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\models\sequential.py":209:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\models\functional.py":175:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\function.py":171:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\models\functional.py":556:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\layers\layer.py":882:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\operation.py":46:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":156:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\layers\convolutional\base_conv.py":252:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\numpy.py":4440:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\numpy.py":1789:1 at "C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\core.py":65:1))))))))))))))))))))))))))]): error: missing attribute 'value'
LLVM ERROR: Failed to infer result type(s).
I've tried using TFLiteConverter.from_saved_model() and the error is the same:
2024-07-12 13:02:00.755686: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:268] disabling MLIR crash reproducer, set env var MLIR_CRASH_REPRODUCER_DIRECTORY to enable.
loc(fused["ReadVariableOp:", "sequential_1/conv2d_1/Reshape/ReadVariableOp@__inference_serving_default_253"]): error: missing attribute 'value'
LLVM ERROR: Failed to infer result type(s).
Hello,
(Sorry in advance, this is the first time asking for help)
I've trained a CNN model with the summary:
Model: "sequential" +--------------------------------------------------------------------------+ | Layer (type) | Output Shape | Param # | |---------------------------------+------------------------+---------------| | conv2d (Conv2D) | (None, 22, 22, 64) | 640 | |---------------------------------+------------------------+---------------| | max_pooling2d (MaxPooling2D) | (None, 22, 22, 64) | 0 | |---------------------------------+------------------------+---------------| | dropout (Dropout) | (None, 22, 22, 64) | 0 | |---------------------------------+------------------------+---------------| | conv2d_1 (Conv2D) | (None, 20, 20, 64) | 36,928 | |---------------------------------+------------------------+---------------| | max_pooling2d_1 (MaxPooling2D) | (None, 20, 20, 64) | 0 | |---------------------------------+------------------------+---------------| | dropout_1 (Dropout) | (None, 20, 20, 64) | 0 | |---------------------------------+------------------------+---------------| | flatten (Flatten) | (None, 25600) | 0 | |---------------------------------+------------------------+---------------| | dense (Dense) | (None, 128) | 3,276,928 | |---------------------------------+------------------------+---------------| | dropout_2 (Dropout) | (None, 128) | 0 | |---------------------------------+------------------------+---------------| | dense_1 (Dense) | (None, 10) | 1,290 | +--------------------------------------------------------------------------+ Total params: 9,947,360 (37.95 MB) Trainable params: 3,315,786 (12.65 MB) Non-trainable params: 0 (0.00 B) Optimizer params: 6,631,574 (25.30 MB)
When I try to convert it using TFLiteConverter.from_keras_model() it shows this message:
W0000 00:00:1720784699.493145 16596 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format. W0000 00:00:1720784699.493345 16596 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency. 2024-07-12 12:44:59.496116: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: C:\Users\fortu\AppData\Local\Temp\tmpkx2rwx8u 2024-07-12 12:44:59.500208: I tensorflow/cc/saved_model/reader.cc:51] Reading meta graph with tags { serve } 2024-07-12 12:44:59.500407: I tensorflow/cc/saved_model/reader.cc:146] Reading SavedModel debug info (if present) from: C:\Users\fortu\AppData\Local\Temp\tmpkx2rwx8u 2024-07-12 12:44:59.538953: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled 2024-07-12 12:44:59.543003: I tensorflow/cc/saved_model/loader.cc:234] Restoring SavedModel bundle. 2024-07-12 12:44:59.806929: I tensorflow/cc/saved_model/loader.cc:218] Running initialization op on SavedModel bundle at path: C:\Users\fortu\AppData\Local\Temp\tmpkx2rwx8u 2024-07-12 12:44:59.860358: I tensorflow/cc/saved_model/loader.cc:317] SavedModel load for tags { serve }; Status: success: OK. Took 364273 microseconds. 2024-07-12 12:44:59.933146: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:268] disabling MLIR crash reproducer, set env var
MLIR_CRASH_REPRODUCER_DIRECTORY
to enable. loc(fused["ReadVariableOp:", callsite("sequential_1/conv2d_1/Reshape/ReadVariableOp@__inference_serving_default_253"("c:\Users\fortu\Desktop\TFC\convertToLite.py":13:1) at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1175:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1129:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1636:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1614:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\convert_phase.py":205:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\lite\python\lite.py":1537:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\layer.py":58:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\layer.py":120:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\layers\layer.py":882:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\operation.py":46:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":156:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\models\sequential.py":209:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\models\functional.py":175:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\function.py":171:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\models\functional.py":556:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\layers\layer.py":882:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":117:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\operation.py":46:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py":156:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\layers\convolutional\base_conv.py":252:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\ops\numpy.py":4440:1 at callsite("C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\numpy.py":1789:1 at "C:\Users\fortu\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\backend\tensorflow\core.py":65:1))))))))))))))))))))))))))]): error: missing attribute 'value' LLVM ERROR: Failed to infer result type(s).I've tried using TFLiteConverter.from_saved_model() and the error is the same:
2024-07-12 13:02:00.755686: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:268] disabling MLIR crash reproducer, set env var
MLIR_CRASH_REPRODUCER_DIRECTORY
to enable. loc(fused["ReadVariableOp:", "sequential_1/conv2d_1/Reshape/ReadVariableOp@__inference_serving_default_253"]): error: missing attribute 'value' LLVM ERROR: Failed to infer result type(s).Tensorflow version: 2.16.2
Thank you in advance