microsoft / SoftTeacher

Semi-Supervised Learning, Object Detection, ICCV2021
MIT License
904 stars 123 forks source link

--resume-from functionality #140

Open lakshya-4gp opened 2 years ago

lakshya-4gp commented 2 years ago

I would recommend following changes, which 1) Currently, even if auto_resume is not mentioned in the config, find_latest_checkpoint command will still run as cfg.get("auto_resume", True) would return True if not found. 2) would give preference to cfg.resume_from over cfg.auto_resume [Optional]

    diff --git a/ssod/apis/train.py b/ssod/apis/train.py
    index b8bf516..1655901 100644
    --- a/ssod/apis/train.py
    +++ b/ssod/apis/train.py
    @@ -194,9 +194,9 @@ def train_detector(

         runner = patch_runner(runner)
         resume_from = None
    -    if cfg.get("auto_resume", True):
    +    if cfg.get("auto_resume", None):
             resume_from = find_latest_checkpoint(cfg.work_dir)
    -    if resume_from is not None:
    +    if resume_from is not None and cfg.get("resume_from", False):
             cfg.resume_from = resume_from

         if cfg.resume_from:
MendelXu commented 2 years ago

Thanks for your advice. I think just changing the default value of auto_resume to False should works. I will update it.