Skip to content

Commit d49968f

Browse files
authored
清理废弃函数1013 (#75802)
1 parent 1a45628 commit d49968f

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

python/paddle/base/incubate/checkpoint/checkpoint_saver.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -195,30 +195,3 @@ def _get_last_checkpoint_no(self, root_path):
195195
return a[-1]
196196

197197
return -1
198-
199-
def clean_redundant_checkpoints(self, root_path, reserved=[]):
200-
max_no = self._get_last_checkpoint_no(root_path)
201-
if max_no < 0:
202-
return
203-
204-
s = set(reserved)
205-
if len(s) == 0:
206-
s.add(max_no)
207-
208-
dirs = self._fs.list_dirs(root_path)
209-
for d in dirs:
210-
g = d.split(".")
211-
if len(g) != 2:
212-
continue
213-
214-
if g[0] != self._checkpoint_prefix:
215-
continue
216-
217-
try:
218-
n = int(g[1])
219-
if n not in s:
220-
path = f"{root_path}/{self._checkpoint_prefix}.{n}"
221-
self._fs.delete(path)
222-
except Exception as e:
223-
print(e)
224-
continue

0 commit comments

Comments
 (0)