Comments (9)
Seeing the same issue on my side after upgrading to tf 2.16.1 from 2.15, with tf2onnx 1.16.1 I can confirm that using
model.output_names = ['output']
is a workaround.However, I later hit another issue similar to this one; tensorflow/tensorflow#63867
I am also running into the same problem. model.output_names = ['output']
fixed the first error, and led to the error you linked.
from tensorflow-onnx.
Seeing the same issue on my side after upgrading to tf 2.16.1 from 2.15, with tf2onnx 1.16.1
I can confirm that using model.output_names = ['output']
is a workaround.
However, I later hit another issue similar to this one; tensorflow/tensorflow#63867
from tensorflow-onnx.
I solved my problem :
model.output_names=['output']
and error vanished...
Where is it written in manual?
from tensorflow-onnx.
Calling code below, it works well without errors you mentioned. So I'm wondering if output_names are lost after calling model.fit(). Could you please check it?
model = my_model_cnn()
input_signature = [tf.TensorSpec(model.inputs[0].shape, model.inputs[0].dtype, name='digit')]
onnx_model, _ = tf2onnx.convert.from_keras(model, input_signature, opset=13)
from tensorflow-onnx.
Ok I Changed my code. Now I wrote
model = my_model_cnn()
model_name = "mymnist_cnn"
input_signature = [tf.TensorSpec(model.inputs[0].shape, model.inputs[0].dtype, name='digit')]
# model.output_names=['output']
onnx_model, _ = tf2onnx.convert.from_keras(model, input_signature, opset=13)
onnx.save(onnx_model, model_name + ".onnx")
model.compile(optimizer='adam',loss=tf.keras.losses.categorical_crossentropy,metrics=['CategoricalAccuracy'])
....
historique = model.fit(train_dataset,steps_per_epoch=69000 // BATCH_SIZE -1,
epochs=num_epochs+epoch_save,
initial_epoch = epoch_save,
validation_data=test_dataset,
callbacks=[tensorboard_callback, checkpoint_callback])
There is still an error :
2024-03-21 06:56:44.746665: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-03-21 06:56:45.100064: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
WARNING:tensorflow:From C:\Users\laurent\AppData\Roaming\Python\Python310\site-packages\tf2onnx\tf_loader.py:68: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.
WARNING:tensorflow:From C:\Users\laurent\AppData\Roaming\Python\Python310\site-packages\tf2onnx\tf_loader.py:72: The name tf.train.import_meta_graph is deprecated. Please use tf.compat.v1.train.import_meta_graph instead.
2024-03-21 06:56:46.739390: 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 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "C:\data\mnist\create_dataset_tf2.py", line 175, in <module>
onnx_model, _ = tf2onnx.convert.from_keras(model, input_signature, opset=13)
File "C:\Users\laurent\AppData\Roaming\Python\Python310\site-packages\tf2onnx\convert.py", line 442, in from_keras
old_out_names = _rename_duplicate_keras_model_names(model)
File "C:\Users\laurent\AppData\Roaming\Python\Python310\site-packages\tf2onnx\convert.py", line 331, in _rename_duplicate_keras_model_names
if model.output_names and len(set(model.output_names)) != len(model.output_names):
AttributeError: 'Sequential' object has no attribute 'output_names'. Did you mean: 'output_shape'?
but now I note this warning (sorry I did not post all error message previously)
WARNING:tensorflow:From C:\Users\laurent\AppData\Roaming\Python\Python310\site-packages\tf2onnx\tf_loader.py:72: The name tf.train.import_meta_graph is deprecated. Please use tf.compat.v1.train.import_meta_graph instead.
I work on windows so i use same code with WSL2 no warning and no error model is saved with new code but it is
tensorflow 2.15.1
tensorflow-addons 0.22.0
tensorflow-datasets 4.9.3
tensorflow-estimator 2.15.0
tensorflow-io-gcs-filesystem 0.32.0
tensorflow-metadata 1.14.0
tensorrt 8.5.3.1
tf2onnx 1.16.1
onnx 1.14.0
onnxruntime 1.15.1
onnxsim 0.4.33
python3 create_dataset_tf2.py
2024-03-21 07:00:44.449223: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-03-21 07:00:44.467172: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-03-21 07:00:44.467207: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-03-21 07:00:44.467680: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-03-21 07:00:44.470713: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-03-21 07:00:44.800301: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2024-03-21 07:00:45.358000: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:45.371909: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:45.371962: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:45.375284: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:45.375335: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:45.375362: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.059354: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.059422: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.059439: I tensorflow/core/common_runtime/gpu/gpu_device.cc:2022] Could not identify NUMA node of platform GPU id 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2024-03-21 07:00:46.059469: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.059491: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1929] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 21596 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:01:00.0, compute capability: 8.6
2024-03-21 07:00:46.790528: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.790569: I tensorflow/core/grappler/devices.cc:66] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 1
2024-03-21 07:00:46.790925: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-21 07:00:46.791286: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.791333: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.791358: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.791513: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.791544: I tensorflow/core/common_runtime/gpu/gpu_device.cc:2022] Could not identify NUMA node of platform GPU id 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2024-03-21 07:00:46.791562: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.791572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1929] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 21596 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:01:00.0, compute capability: 8.6
2024-03-21 07:00:46.815331: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.815379: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.815403: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.815573: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.815745: I tensorflow/core/common_runtime/gpu/gpu_device.cc:2022] Could not identify NUMA node of platform GPU id 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2024-03-21 07:00:46.815827: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.815849: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1929] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 21596 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:01:00.0, compute capability: 8.6
2024-03-21 07:00:46.818966: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.818999: I tensorflow/core/grappler/devices.cc:66] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 1
2024-03-21 07:00:46.819064: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-21 07:00:46.819249: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.819273: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.819293: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.819394: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.819409: I tensorflow/core/common_runtime/gpu/gpu_device.cc:2022] Could not identify NUMA node of platform GPU id 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2024-03-21 07:00:46.819437: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-21 07:00:46.819454: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1929] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 21596 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:01:00.0, compute capability: 8.6
Epoch 1/2
2024-03-21 07:01:05.241732: I external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:454] Loaded cuDNN version 8904
2024-03-21 07:01:06.098691: I external/local_xla/xla/service/service.cc:168] XLA service 0x5597c1b82fe0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2024-03-21 07:01:06.098714: I external/local_xla/xla/service/service.cc:176] StreamExecutor device (0): NVIDIA GeForce RTX 3090, Compute Capability 8.6
2024-03-21 07:01:06.101540: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:269] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1711000866.141881 2374 device_compiler.h:186] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.
534/538 [============================>.] - ETA: 0s - loss: 3.3772 - categorical_accuracy: 0.4657
Epoch 1: val_loss improved from 1000000000.00000 to 2.42523, saving model to /mnt/c/tmp/mnistv1/chk/mnist_0000001_.weights.h5
538/538 [==============================] - 24s 8ms/step - loss: 3.3665 - categorical_accuracy: 0.4622 - val_loss: 2.4252 - val_categorical_accuracy: 0.1082
Epoch 2/2
537/538 [============================>.] - ETA: 0s - loss: 1.8717 - categorical_accuracy: 0.5926
Epoch 2: val_loss did not improve from 2.42523
538/538 [==============================] - 5s 9ms/step - loss: 1.8683 - categorical_accuracy: 0.5934 - val_loss: 10.5518 - val_categorical_accuracy: 0.1271
from tensorflow-onnx.
After installing tf 2.15.1 all the errors went away (still using tf2onnx 1.16.1).
Not sure who his to blame here, but there is at least a compatibility issue with tf 2.16
from tensorflow-onnx.
I posted another issue about tflite : problem with tf 2.16 but not with 2.15
Tensorflow or onnx?
from tensorflow-onnx.
I posted another issue about tflite : problem with tf 2.16 but not with 2.15 Tensorflow or onnx?
By the issue you described in TensorFlow repo, I think we should make sure the tflite model is correct and then check if it could be converted to ONNX successfully.
from tensorflow-onnx.
By the issue you described in TensorFlow repo, I think we should make sure the tflite model is correct and then check if it could be converted to ONNX successfully.
I think that there is a bug in TF2.16.1 with consequence on tfonnx and saving tflite model.
For fun model is lenet5 and may be I can call tf2.16.1 oedipe version
from tensorflow-onnx.
Related Issues (20)
- Maxpool 2D layer error `Negative dimension size caused by subtracting 2 from 1 input shape shape=(128, 128, 1, 16)`
- tf.image.resize can't convert to FP16 model HOT 1
- Azure pipeline task CondaEnvironment@1 has been deprecated.
- Integrate with ONNX 1.16.0 release branch HOT 1
- Error of input shape {0,32,1,1} when infer with generated onnx model HOT 1
- Model conversion fail from Tensorflow while 2 GPU are utilized and first one set to be not visible in Tensorflow HOT 1
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 101: invalid start byte
- Converting TF on numpy 1.26
- Please help validate release candidate for ONNX 1.16.0rc2 HOT 1
- tf.linalg.eigh not supported in tf2onnx
- publish a command line executable on releases HOT 2
- Is it possible to convert tflite to onnx with changed input dimension?
- There are discrepancies between the outputs of the Ttflite and converted ONNX model.
- DirectML returning empty result with ObjectDetection (Mobilinet V2 FPN Keras) HOT 3
- Registering operator for tf.linalg.eig
- Project requires an old version of Protobuf HOT 4
- Tensorflow 2.16 / Keras 3 support HOT 1
- multiple inputs
- NA GERAÇÃO DO VÍDEO RETORNOU A SEGUINTE MENSAGEM DE ERRO : RuntimeError: Error in execution: Non-zero status code returned while running Transpose node.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow-onnx.