# Restarting training from a checkpoint

**URL:** <https://discuss.huggingface.co/t/restarting-training-from-a-checkpoint/22367>\
**Category:** 🧨 Diffusers\
**Created:** [August 31, 2022, 9:02pm UTC](https://discuss.huggingface.co/t/restarting-training-from-a-checkpoint/22367 "2022-08-31T21:02:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![madams](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/madams/32/5838_2.png) [@madams](https://discuss.huggingface.co/u/madams)\
**Post date:** [August 31, 2022, 9:02pm UTC](https://discuss.huggingface.co/t/restarting-training-from-a-checkpoint/22367/1 "2022-08-31T21:02:26Z")

</div>

I’m following through the [Training a diffusers model](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/training_example.ipynb) notebook and I’ve adapted it and run 50 epochs on my own dataset. I’m running on Colab so I need to do training in small-ish bursts, so I’d like to set the notebook up to start training from the last checkpoint.

Reading through the code I saw how to load a pretrained model and that it needs to be set from eval mode back to train, which I’ve done with:

```python
model = UNet2DModel.from_pretrained(previous_checkpoint_dir + '/unet')
model.train()

```

I then ran the rest of the notebook code as-is (apart of some code to find the last checkpoint) to restart the training. Is there any more to it than that?
