Closed alexionby closed 2 years ago
It's probably a bug in Keras. The option to convert to h5 was removed a long time ago, as there are many bugs related to loading h5.
$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> m = tf.saved_model.load('saved_model')
INFO:tensorflow:Saver not created because there are no variables in the graph to restore
2021-10-20 12:41:15.226458: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /opt/intel/openvino_2021/data_processing/dl_streamer/lib:/opt/intel/openvino_2021/data_processing/gstreamer/lib:/opt/intel/openvino_2021/opencv/lib:/opt/intel/openvino_2021/deployment_tools/ngraph/lib:/opt/intel/openvino_2021/deployment_tools/inference_engine/external/tbb/lib::/opt/intel/openvino_2021/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino_2021/deployment_tools/inference_engine/external/omp/lib:/opt/intel/openvino_2021/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino_2021/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino_2021/deployment_tools/inference_engine/lib/intel64:/usr/local/cuda/compat/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2021-10-20 12:41:15.226478: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2021-10-20 12:41:15.226496: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:163] no NVIDIA GPU device is present: /dev/nvidia0 does not exist
2021-10-20 12:41:15.226629: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-10-20 12:41:15.237417: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
>>>
Got it. Thank you. Conversion to tensorflow works fine.
I hoped that it's possible to retrain this model from saved weights via keras.model.fit()
method.
1. Ubuntu 18.04
2. OS Architecture x86_64
4. Version of TensorFlow e.g. v2.6.0
9. segm_full_sparse_v1008.tflite
10. Coverted model
Converted by command (from Docker):
tflite2tensorflow --model_path segm_full_sparse_v1008.tflite --flatc_path ../flatc --schema_path ../schema.fbs --output_pb
12. Issue Details
This code:
temp = tf.keras.models.load_model("saved_model/", compile=False, )
Produce error:How to convert this model to Keras (h5) ?