From 450f149ff4e6b07105788267aaf65a5409813aba Mon Sep 17 00:00:00 2001 From: caozhou Date: Mon, 28 Dec 2020 16:32:39 +0800 Subject: [PATCH] fix remove meta in pynative mode error --- mindspore/train/callback/_checkpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindspore/train/callback/_checkpoint.py b/mindspore/train/callback/_checkpoint.py index 37229ec23f..9ddc339062 100644 --- a/mindspore/train/callback/_checkpoint.py +++ b/mindspore/train/callback/_checkpoint.py @@ -276,7 +276,7 @@ class ModelCheckpoint(Callback): # save graph (only once) if not self._graph_saved: graph_file_name = os.path.join(self._directory, self._prefix + '-graph.meta') - if os.path.isfile(graph_file_name): + if os.path.isfile(graph_file_name) and context.get_context("mode") == context.GRAPH_MODE: os.remove(graph_file_name) _save_graph(cb_params.train_network, graph_file_name) self._graph_saved = True