Skip to content

Commit

Permalink
Fix resume_or_load() method in setup_training()
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanklut committed Jan 31, 2024
1 parent 32c6834 commit cf0b6e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ def setup_training(args: argparse.Namespace):

trainer = Trainer(cfg=cfg)
if not cfg.TRAIN.WEIGHTS:
trainer.resume_or_load(resume=cfg.MODEL.RESUME)
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)
else:
trainer.checkpointer.load(cfg.TRAIN.WEIGHTS)
# if trainer.checkpointer.has_checkpoint():
trainer.start_iter = trainer.iter + 1

results = trainer.train()
Expand Down

0 comments on commit cf0b6e1

Please sign in to comment.