diff --git a/ppdet/utils/download.py b/ppdet/utils/download.py index 58f7be307733b26c6a366ad8f9f54adfb75926e1..6e4cb4019a0a4252e6a11c7f15c16b2bf5d7f562 100644 --- a/ppdet/utils/download.py +++ b/ppdet/utils/download.py @@ -213,7 +213,10 @@ def get_path(url, root_dir, md5sum=None, check_exist=True): logger.debug("Found {}".format(fullpath)) return fullpath, True else: - shutil.rmtree(fullpath) + if osp.isdir(fullpath): + shutil.rmtree(fullpath) + else: + os.remove(fullpath) fullname = _download(url, root_dir, md5sum)