3

Actually i am training a deep learning model and want to save checkpoint of the model but its stopped when power is off then i have to start from that point from which its interrupted like 10 epoches completed and want to resume/start again from epoch 11 with that parameters

Hamzah
  • 8,175
  • 3
  • 19
  • 43

1 Answers1

1

In PyTorch, you can resume from a specific point by using epoch key from the checkpoint dictionary as follows:

# Load model checkpoint
checkpoint = torch.load("checkpoint.pth")
model.load_state_dict(checkpoint['model'])
epoch = checkpoint['epoch']

# Resume training from a specific epoch
for epoch in range(epoch + 1, num_epochs):
    ...
Hamzah
  • 8,175
  • 3
  • 19
  • 43