I cannot load face classification models with tensorflow >= 2.16.1
To Reproduce
the following lines of code works well with tf 2.15.1 but do not finish with tensorflow 2.16.1
from tensorflow import keras
keras.models.load_model('/home/ddoukhan/.keras/inaFaceAnalyzer/keras_resnet50_fairface_GRA.h5')
Expected behavior
code finish
Current behavior
code do not finish, when I stop it with ctrl+c, I got the following message :
(env) ddoukhan@rex-gpu15:/tmp/inaFaceAnalyzer$ python bug.py
2024-10-07 17:18:33.688437: 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-10-07 17:18:33.688590: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-10-07 17:18:33.690326: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2024-10-07 17:18:33.711355: 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.
2024-10-07 17:18:34.026615: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2024-10-07 17:18:34.305210: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355
2024-10-07 17:18:34.305388: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
^CTraceback (most recent call last):
File "/tmp/inaFaceAnalyzer/bug.py", line 3, in
keras.models.load_model('/home/ddoukhan/.keras/inaFaceAnalyzer/keras_resnet50_fairface_GRA.h5')
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 196, in load_model
return legacy_h5_format.load_model_from_hdf5(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 133, in load_model_from_hdf5
model = saving_utils.model_from_config(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
return serialization.deserialize_keras_object(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 495, in deserialize_keras_object
deserialized_obj = cls.from_config(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/models/model.py", line 526, in from_config
return functional_from_config(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/models/functional.py", line 515, in functional_from_config
while node_index < len(node_data_list):
KeyboardInterrupt
Environment
Please provide the following details on your environment :
OS and distribution (eg: Linux Ubuntu 20.04) : Linux rex-gpu15 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 11 15:25:05 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Python version : 3.10.12
Tensorflow version : 2.15.1 / 2.16.1
output of command pip freeze :
Amount of available RAM :
Running on GPU or CPU :
output of command nvidia-smi (if GPU is used) :
CUDA and CuDNN versions (if GPU is used) :
installation type (from sources, from pypi, from dockerhub ?) :
Describe the bug
I cannot load face classification models with tensorflow >= 2.16.1
To Reproduce
the following lines of code works well with tf 2.15.1 but do not finish with tensorflow 2.16.1
from tensorflow import keras keras.models.load_model('/home/ddoukhan/.keras/inaFaceAnalyzer/keras_resnet50_fairface_GRA.h5')
Expected behavior
code finish
Current behavior
code do not finish, when I stop it with ctrl+c, I got the following message : (env) ddoukhan@rex-gpu15:/tmp/inaFaceAnalyzer$ python bug.py 2024-10-07 17:18:33.688437: 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
keras.models.load_model('/home/ddoukhan/.keras/inaFaceAnalyzer/keras_resnet50_fairface_GRA.h5')
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 196, in load_model
return legacy_h5_format.load_model_from_hdf5(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 133, in load_model_from_hdf5
model = saving_utils.model_from_config(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
return serialization.deserialize_keras_object(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 495, in deserialize_keras_object
deserialized_obj = cls.from_config(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/models/model.py", line 526, in from_config
return functional_from_config(
File "/tmp/inaFaceAnalyzer/env/lib/python3.10/site-packages/keras/src/models/functional.py", line 515, in functional_from_config
while node_index < len(node_data_list):
KeyboardInterrupt
TF_ENABLE_ONEDNN_OPTS=0
. 2024-10-07 17:18:33.688590: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used. 2024-10-07 17:18:33.690326: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used. 2024-10-07 17:18:33.711355: 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. 2024-10-07 17:18:34.026615: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2024-10-07 17:18:34.305210: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 2024-10-07 17:18:34.305388: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... ^CTraceback (most recent call last): File "/tmp/inaFaceAnalyzer/bug.py", line 3, inEnvironment
Please provide the following details on your environment :
pip freeze
:nvidia-smi
(if GPU is used) :Additional context
Add any other context about the problem here.