我是靠谱客的博主 动人白开水,这篇文章主要介绍KeyError: ‘Failed to format this callback filepath: “./saved_models/model_batch{batch}.h5“. Reason:,现在分享给大家,希望可以做个参考。
Environment: Win10 + tensorflow2.3.1 + python3.6
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 1330, in _get_file_path file_path = self.filepath.format(epoch=epoch + 1, **logs) KeyError: 'batch' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:/WData/Development/table_direction_detection/4_directions/Derection-Classify/train.py", line 168, in <module> trainer.train() File "D:/WData/Development/table_direction_detection/4_directions/Derection-Classify/train.py", line 131, in train callbacks=callbacks) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerasenginetraining.py", line 108, in _method_wrapper return method(self, *args, **kwargs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerasenginetraining.py", line 1103, in fit callbacks.on_train_batch_end(end_step, logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 440, in on_train_batch_end self._call_batch_hook(ModeKeys.TRAIN, 'end', batch, logs=logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 289, in _call_batch_hook self._call_batch_end_hook(mode, batch, logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 309, in _call_batch_end_hook self._call_batch_hook_helper(hook_name, batch, logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 342, in _call_batch_hook_helper hook(batch, logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 1240, in on_train_batch_end self._save_model(epoch=self._current_epoch, logs=logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 1282, in _save_model filepath = self._get_file_path(epoch, logs) File "C:Users12575AppDataRoamingPythonPython36site-packagestensorflowpythonkerascallbacks.py", line 1333, in _get_file_path 'Reason: {}'.format(self.filepath, e)) KeyError: 'Failed to format this callback filepath: "./saved_models/model_batch{batch}.h5". Reason: 'batch''
Problem location:
修改配置文件config.yml中的
复制代码
1h5_savePath: './saved_models/model_batch{batch}.h5'
改成
复制代码
1h5_savePath: './saved_models/model_epoch{epoch}.h5'
最后
以上就是动人白开水最近收集整理的关于KeyError: ‘Failed to format this callback filepath: “./saved_models/model_batch{batch}.h5“. Reason:的全部内容,更多相关KeyError:内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复