-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Having non-converted operations, even for simplest models #62855
Comments
perhaps "TF-TRT Warning: Could not find TensorRT" ? |
I have just got the same issue for TensorFlow 2.15.0 on my M3 Pro MacBook. It seems that TF Lite somehow failed to support 20 |
Hi @Black3rror, Good observation. Exactly, when running
then run the code for accuracy checking. 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. |
@zhuochenKIDD Are you suggesting that I fix the TensorRT warning and the problem with Non-Converted Ops will get resolved automatically? @LakshmiKalaKadali Hi, and thanks for the response. |
Hi @Black3rror, you can still run non-converted ops successfully and because they have higher precision the performance in terms of accuracy is actually usually better, however you lose the benefits of efficiency and latency performance. Not all ops are convertable but I can't imagine that arith.constant is one of them. @zichuan-wei, can you please take a look? Thanks. |
@pkgoogle Also, it might worth mentioning that I've tested different networks with different quantization techniques (including full_int, full_int_only (input and outputs are in int as well), 16x8, ...), and they all worked. I mean, I'm still getting similar non-converted messages to those I asked in the first place, but looking at Can you please clarify your answer? Yes, I also believe something is wrong since I'm not able to convert a minimum network without getting such a message, and as you said, at least |
Hi @Black3rror, if that is the configuration of your conversion then, you are correct, you should not expect any loss of precision, however with any quantization techniques included -- then of course there is a potential loss. Non-converted ops are by definition not going to go through any quantization, so they will maintain precision and still "work" in the sense that you can still run inference through the model. Hope that clarifies my answer? |
@pkgoogle Yes, now things make more sense to me. Still, it leaves me wondering why I'm getting the "non-converted operations" message even in this situation where I'm not using any quantization (based on your reply, this message should be related to quantization conversion). |
I have the same issue of having non converted operations, and my model is quite simple as well. It is just a multi perceptron model with fully connected layers, relu activation and softmax activation functions. I wonder how I can suppress the log message of 'having non-converted operations ......' in the converter.convert() method.
|
seems like a tensorflow version problem. I just change the version from tf2.15 to tf2.10. The non-converted ops are gone... |
I am having the same issue, the model runs fine though. The inference results are as expected. |
Running the same code with TensorFlow version 2.16.1 outputs:
This is an error, and no tflite file will be generated anymore. |
Hi @Black3rror, If I use AI-Edge-Torch, it appears to work well: convert.py import torch
import torch.nn as nn
import ai_edge_torch
class LinearRegression(nn.Module):
def __init__(self):
super().__init__()
self.dense = nn.Linear(1, 1)
def forward(self, x):
return self.dense(x)
model = LinearRegression()
sample_inputs = (torch.randn(1),)
edge_model = ai_edge_torch.convert(model.eval(), sample_inputs)
edge_model.export("lr.tflite") my output: python convert.py
2024-06-11 21:49:20.614022: I external/local_xla/xla/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-06-11 21:49:20.617583: I external/local_xla/xla/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-06-11 21:49:20.656618: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-06-11 21:49:21.702560: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
WARNING:root:PJRT is now the default runtime. For more information, see https://github.com/pytorch/xla/blob/master/docs/pjrt.md
WARNING:root:Defaulting to PJRT_DEVICE=CPU
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1718142563.953505 816506 cpu_client.cc:424] TfrtCpuClient created.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
W0000 00:00:1718142565.742263 816506 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format.
W0000 00:00:1718142565.742290 816506 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency.
2024-06-11 21:49:25.743230: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: /tmp/tmp1n3s0fho
2024-06-11 21:49:25.743512: I tensorflow/cc/saved_model/reader.cc:52] Reading meta graph with tags { serve }
2024-06-11 21:49:25.743532: I tensorflow/cc/saved_model/reader.cc:147] Reading SavedModel debug info (if present) from: /tmp/tmp1n3s0fho
2024-06-11 21:49:25.748880: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
2024-06-11 21:49:25.749202: I tensorflow/cc/saved_model/loader.cc:236] Restoring SavedModel bundle.
2024-06-11 21:49:25.760743: I tensorflow/cc/saved_model/loader.cc:220] Running initialization op on SavedModel bundle at path: /tmp/tmp1n3s0fho
2024-06-11 21:49:25.764008: I tensorflow/cc/saved_model/loader.cc:462] SavedModel load for tags { serve }; Status: success: OK. Took 20779 microseconds.
2024-06-11 21:49:25.770494: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:268] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
2024-06-11 21:49:25.803013: I tensorflow/compiler/mlir/lite/flatbuffer_export.cc:3531] Estimated count of arithmetic ops: 3 ops, equivalently 1 MACs
I0000 00:00:1718142566.683158 816506 cpu_client.cc:427] TfrtCpuClient destroyed. Does this resolve your issue? |
Hi @pkgoogle, and thanks a lot for your answer. I've opened this issue to help identify a problem with TFLite in the hope that it will be improved. Even though a workaround might be very helpful, I hope the problem gets resolved entirely. |
Hi @Black3rror, thanks for the feedback, that is helpful. |
System information
Steps to reproduce
!python test.py
Note: running the code directly in Jupyter Notebook won't print anything
Problem
The text was updated successfully, but these errors were encountered: