Closed saurabh1043 closed 4 years ago
Are you using Tensorflow v2.3.0?
I'm using Tensorflow 2.2.0
I'm not familiar with miniconda, but at least Tensorflow v2.3.0 was able to load it successfully. See below.
$ python3
Python 3.6.9 (default, Jul 17 2020, 12:50:27)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-08-15 13:59:29.183339: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
>>> tf.__version__
'2.3.0'
>>> imported = tf.saved_model.load('saved_model_pose_detection')
2020-08-15 13:59:47.500567: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-08-15 13:59:47.515226: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.515729: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1070 with Max-Q Design computeCapability: 6.1
coreClock: 1.2655GHz coreCount: 16 deviceMemorySize: 7.93GiB deviceMemoryBandwidth: 238.66GiB/s
2020-08-15 13:59:47.515749: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-08-15 13:59:47.516876: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-08-15 13:59:47.517969: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-08-15 13:59:47.518149: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-08-15 13:59:47.519280: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-08-15 13:59:47.519932: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-08-15 13:59:47.522420: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-08-15 13:59:47.522520: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.523062: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.523530: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-08-15 13:59:47.523739: 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: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-08-15 13:59:47.549960: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2199995000 Hz
2020-08-15 13:59:47.551139: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x82d3780 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-08-15 13:59:47.551159: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-08-15 13:59:47.597910: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.598558: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x833f190 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-08-15 13:59:47.598575: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 1070 with Max-Q Design, Compute Capability 6.1
2020-08-15 13:59:47.598817: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.599346: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1070 with Max-Q Design computeCapability: 6.1
coreClock: 1.2655GHz coreCount: 16 deviceMemorySize: 7.93GiB deviceMemoryBandwidth: 238.66GiB/s
2020-08-15 13:59:47.599367: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-08-15 13:59:47.599384: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-08-15 13:59:47.599394: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-08-15 13:59:47.599405: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-08-15 13:59:47.599434: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-08-15 13:59:47.599462: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-08-15 13:59:47.599509: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-08-15 13:59:47.599582: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.600075: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:47.600540: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-08-15 13:59:47.600559: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-08-15 13:59:48.052606: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-08-15 13:59:48.052637: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263] 0
2020-08-15 13:59:48.052643: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0: N
2020-08-15 13:59:48.052835: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:48.053397: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 13:59:48.053911: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7025 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 6.1)
>>>
Updated to Tensorflow v2.3.0 and it's working now. Thanks :)
model = keras.models.load_model('saved_model_pose_detection')
TypeError Traceback (most recent call last) in ----> 1 model = keras.models.load_model('saved_model_pose_detection')
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\save.py in load_model(filepath, custom_objects, compile) 188 if isinstance(filepath, six.string_types): 189 loader_impl.parse_saved_model(filepath) --> 190 return saved_model_load.load(filepath, compile) 191 192 raise IOError(
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in load(path, compile) 114 # TODO(kathywu): Add saving/loading of optimizer, compiled losses and metrics. 115 # TODO(kathywu): Add code to load from objects that contain all endpoints --> 116 model = tf_load.load_internal(path, loader_cls=KerasObjectLoader) 117 118 # pylint: disable=protected-access
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\saved_model\load.py in load_internal(export_dir, tags, loader_cls) 602 loader = loader_cls(object_graph_proto, 603 saved_model_proto, --> 604 export_dir) 605 root = loader.get(0) 606 if isinstance(loader, Loader):
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in init(self, *args, *kwargs) 186 self._models_to_reconstruct = [] 187 --> 188 super(KerasObjectLoader, self).init(args, **kwargs) 189 190 # Now that the node object has been fully loaded, and the checkpoint has
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\saved_model\load.py in init(self, object_graph_proto, saved_model_proto, export_dir) 121 self._concrete_functions[name] = _WrapperFunction(concrete_function) 122 --> 123 self._load_all() 124 self._restore_checkpoint() 125
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in _load_all(self) 207 # loaded from config may create variables / other objects during 208 # initialization. These are recorded in
_nodes_recreated_from_config
. --> 209 self._layer_nodes = self._load_layers() 210 211 # Load all other nodes and functions.~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in _load_layers(self) 307 continue 308 --> 309 layers[node_id] = self._load_layer(proto.user_object, node_id) 310 311 for node_id, proto in metric_list:
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in _load_layer(self, proto, node_id) 333 # Detect whether this object can be revived from the config. If not, then 334 # revive from the SavedModel instead. --> 335 obj, setter = self._revive_from_config(proto.identifier, metadata, node_id) 336 if obj is None: 337 obj, setter = revive_custom_object(proto.identifier, metadata)
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in _revive_from_config(self, identifier, metadata, node_id) 351 obj = ( 352 self._revive_graph_network(metadata, node_id) or --> 353 self._revive_layer_from_config(metadata, node_id)) 354 355 if obj is None:
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py in _revive_layer_from_config(self, metadata, node_id) 406 try: 407 obj = layers_module.deserialize( --> 408 generic_utils.serialize_keras_class_and_config(class_name, config)) 409 except ValueError: 410 return None
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\layers\serialization.py in deserialize(config, custom_objects) 107 module_objects=globs, 108 custom_objects=custom_objects, --> 109 printable_module_name='layer')
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name) 373 list(custom_objects.items()))) 374 with CustomObjectScope(custom_objects): --> 375 return cls.from_config(cls_config) 376 else: 377 # Then
cls
may be a function returning a class.~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in from_config(cls, config) 653 A layer instance. 654 """ --> 655 return cls(**config) 656 657 def compute_output_shape(self, input_shape):
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\layers\convolutional.py in init(self, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, kwargs) 597 kernel_constraint=constraints.get(kernel_constraint), 598 bias_constraint=constraints.get(bias_constraint), --> 599 kwargs) 600 601
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\layers\convolutional.py in init(self, rank, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, kwargs) 123 name=name, 124 activity_regularizer=regularizers.get(activity_regularizer), --> 125 kwargs) 126 self.rank = rank 127 if filters is not None and not isinstance(filters, int):
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\training\tracking\base.py in _method_wrapper(self, *args, *kwargs) 454 self._self_setattr_tracking = False # pylint: disable=protected-access 455 try: --> 456 result = method(self, args, **kwargs) 457 finally: 458 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in init(self, trainable, name, dtype, dynamic, **kwargs) 292 } 293 # Validate optional keyword arguments. --> 294 generic_utils.validate_kwargs(kwargs, allowed_kwargs) 295 296 # Mutable properties
~\miniconda3\envs\py36\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message) 790 for kwarg in kwargs: 791 if kwarg not in allowed_kwargs: --> 792 raise TypeError(error_message, kwarg) 793 794
TypeError: ('Keyword argument not understood:', 'groups')