OCR_detection_IC15 icon indicating copy to clipboard operation
OCR_detection_IC15 copied to clipboard

Something wrong with the resume_checkpoint

Open 10183308 opened this issue 6 years ago • 1 comments

when I fine tune on the pretrained modle ?

it can not train with multi -gpus.

I find that : def _resume_checkpoint(self, resume_path): """ Resume from saved checkpoints

    :param resume_path: Checkpoint path to be resumed
    """
    self.logger.info("Loading checkpoint: {} ...".format(resume_path))
    checkpoint = torch.load(resume_path)
    self.start_epoch = checkpoint['epoch'] + 1
    self.monitor_best = checkpoint['monitor_best']
    self.model.load_state_dict(checkpoint['state_dict'])
    self.optimizer.load_state_dict(checkpoint['optimizer'])
    if self.with_cuda:
        for state in self.optimizer.state.values():
            for k, v in state.items():
                if isinstance(v, torch.Tensor):
                    state[k] = v.cuda(self.gpus) .-------------->self.gpus is dict. And can not train with gpus
    self.train_logger = checkpoint['logger']
    self.config = checkpoint['config']
    self.logger.info("Checkpoint '{}' (epoch {}) loaded".format(resume_path, self.start_epoch))

could you fix the bug?

thank you very much

10183308 avatar Dec 05 '18 08:12 10183308

@10183308 v.cuda(self.device)

novioleo avatar Apr 11 '19 08:04 novioleo