Skip to content

Commit

Permalink
Also load model when not resuming
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanklut committed Jan 31, 2024
1 parent cf0b6e1 commit 37bb3ce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ def setup_training(args: argparse.Namespace):

trainer = Trainer(cfg=cfg)
if not cfg.TRAIN.WEIGHTS:
if cfg.MODEL.RESUME:
if not trainer.checkpointer.has_checkpoint():
raise FileNotFoundError(f"No checkpoint found in {cfg.OUTPUT_DIR}")
trainer.resume_or_load(resume=cfg.MODEL.RESUME)
if cfg.MODEL.RESUME and trainer.checkpointer.has_checkpoint():
raise FileNotFoundError(f"No checkpoint found in {cfg.OUTPUT_DIR}")
trainer.resume_or_load(resume=cfg.MODEL.RESUME)
else:
trainer.checkpointer.load(cfg.TRAIN.WEIGHTS)
trainer.start_iter = trainer.iter + 1
Expand Down

0 comments on commit 37bb3ce

Please sign in to comment.