Update warning if ckpt directory is not empty (#5209)

This commit is contained in:
Rohit Gupta 2020-12-21 06:30:17 +05:30 committed by Jirka Borovec
parent cc14fc16bf
commit fd5322d3e7
1 changed files with 3 additions and 4 deletions

View File

@ -20,11 +20,11 @@ Automatically save model checkpoints during training.
""" """
from copy import deepcopy
import numbers import numbers
import os import os
import re
from copy import deepcopy
from pathlib import Path from pathlib import Path
import re
from typing import Any, Dict, Optional, Union from typing import Any, Dict, Optional, Union
import numpy as np import numpy as np
@ -271,8 +271,7 @@ class ModelCheckpoint(Callback):
and len(self._fs.ls(dirpath)) > 0 and len(self._fs.ls(dirpath)) > 0
): ):
rank_zero_warn( rank_zero_warn(
f"Checkpoint directory {dirpath} exists and is not empty. With save_top_k={save_top_k}," f"Checkpoint directory {dirpath} exists and is not empty."
" all files in this directory will be deleted when a checkpoint is saved!"
) )
if dirpath and self._fs.protocol == 'file': if dirpath and self._fs.protocol == 'file':