cluster-loss-tensorflow icon indicating copy to clipboard operation
cluster-loss-tensorflow copied to clipboard

problems when load pretrained model.

Open git0405 opened this issue 2 years ago • 0 comments

thanks for your help. When i try to reload the pretrained model, the problem is

"Failed to to load model "self.pretrained_model "from save path: %s" % self.pretrained_model) i changed the 'pretrained_model' path in densenet_params{} but it still does not work.

`2023-07-20 20:15:48.131822: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: NewRandomAccessFile failed to Create/Open: C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt.data-00000-of-00001 : ??????????? ; No such process Traceback (most recent call last): File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call return fn(*args) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn target_list, run_metadata) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt.data-00000-of-00001 : ??????????? ; No such process [[{{node save/RestoreV2}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 1290, in restore {self.saver_def.filename_tensor_name: save_path}) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 956, in run run_metadata_ptr) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 1180, in _run feed_dict_tensor, options, run_metadata) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 1359, in _do_run run_metadata) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\client\session.py", line 1384, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt.data-00000-of-00001 : ??????????? ; No such process [[node save/RestoreV2 (defined at \Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]

Original stack trace for 'save/RestoreV2': File "/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/metric_learning.py", line 46, in model.load_pretrained_model() File "\Users\sxz115\Desktop\experiments for test set bound\ranking dataset\Paper-Deep-Metric-Learning-via-Facility-Location-master\metric_learning\densenet.py", line 109, in load_pretrained_model tf.train.Saver(var_to_restore).restore(self.sess, 'C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt') File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 828, in init self.build() File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 840, in build self._build(self._filename, build_save=True, build_restore=True) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 878, in _build build_restore=build_restore) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 508, in _build_internal restore_sequentially, reshape) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 328, in _AddRestoreOps restore_sequentially) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 575, in bulk_restore return io_ops.restore_v2(filename_tensor, names, slices, dtypes) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\ops\gen_io_ops.py", line 1696, in restore_v2 name=name) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op attrs, op_def, compute_device) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal op_def=op_def) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 1300, in restore names_to_keys = object_graph_key_mapping(save_path) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 1618, in object_graph_key_mapping object_graph_string = reader.get_tensor(trackable.OBJECT_GRAPH_PROTO_KEY) File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 915, in get_tensor return CheckpointReader_GetTensor(self, compat.as_bytes(tensor_str)) tensorflow.python.framework.errors_impl.NotFoundError: Key _CHECKPOINTABLE_OBJECT_GRAPH not found in checkpoint

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/metric_learning.py", line 46, in model.load_pretrained_model() File "C:\Users\sxz115\Desktop\experiments for test set bound\ranking dataset\Paper-Deep-Metric-Learning-via-Facility-Location-master\metric_learning\densenet.py", line 109, in load_pretrained_model tf.train.Saver(var_to_restore).restore(self.sess, 'C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt') File "C:\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 1306, in restore err, "a Variable name or other graph key that is missing") tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

NewRandomAccessFile failed to Create/Open: C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt.data-00000-of-00001 : ??????????? ; No such process [[node save/RestoreV2 (defined at \Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]

Original stack trace for 'save/RestoreV2': File "/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/metric_learning.py", line 46, in model.load_pretrained_model() File "\Users\sxz115\Desktop\experiments for test set bound\ranking dataset\Paper-Deep-Metric-Learning-via-Facility-Location-master\metric_learning\densenet.py", line 109, in load_pretrained_model tf.train.Saver(var_to_restore).restore(self.sess, 'C:/Users/sxz115/Desktop/experiments for test set bound/ranking dataset/Paper-Deep-Metric-Learning-via-Facility-Location-master/pretrained_model/DenseNet-BC_growth_rate=12_depth=40_dataset_C100+/model.chkpt') File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 828, in init self.build() File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 840, in build self._build(self._filename, build_save=True, build_restore=True) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 878, in _build build_restore=build_restore) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 508, in _build_internal restore_sequentially, reshape) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 328, in _AddRestoreOps restore_sequentially) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\training\saver.py", line 575, in bulk_restore return io_ops.restore_v2(filename_tensor, names, slices, dtypes) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\ops\gen_io_ops.py", line 1696, in restore_v2 name=name) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op attrs, op_def, compute_device) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal op_def=op_def) File "\Users\sxz115.conda\envs\py37\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

Process finished with exit code 1 ` Any help will be greatly appreciated.

git0405 avatar Jul 20 '23 19:07 git0405