# Saving weights and checkpoints

**URL:** <https://discuss.huggingface.co/t/saving-weights-and-checkpoints/16788>\
**Category:** Intermediate\
**Created:** [April 13, 2022, 12:11pm UTC](https://discuss.huggingface.co/t/saving-weights-and-checkpoints/16788 "2022-04-13T12:11:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaryaAI](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/maryaai/32/14313_2.png) [@MaryaAI](https://discuss.huggingface.co/u/MaryaAI)\
**Post date:** [April 13, 2022, 12:11pm UTC](https://discuss.huggingface.co/t/saving-weights-and-checkpoints/16788/1 "2022-04-13T12:11:44Z")

</div>

I used to use checkpoint callback in Keras, Is there any alternative in Huggingface?  
If I re-run the training cell it continues from the last loss so it is automatically saved?  
Could anyone please explain more about how Huggingface saves partial checkpoints so I can continue later from this point?

---

<div class="post-metadata">

**Author:** ![BramVanroy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bramvanroy/32/47360_2.png) [@BramVanroy](https://discuss.huggingface.co/u/BramVanroy)\
**Post date:** [April 13, 2022, 1:39pm UTC](https://discuss.huggingface.co/t/saving-weights-and-checkpoints/16788/2 "2022-04-13T13:39:09Z")

</div>

Yes, you can control how to deal with checkpoints within the `Trainer` class. Have a read through the [documentation](https://huggingface.co/docs/transformers/main_classes/trainer#checkpoints), which should help you.

---

<div class="post-metadata">

**Author:** ![MaryaAI](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/maryaai/32/14313_2.png) [@MaryaAI](https://discuss.huggingface.co/u/MaryaAI)\
**Post date:** [April 14, 2022, 7:19am UTC](https://discuss.huggingface.co/t/saving-weights-and-checkpoints/16788/3 "2022-04-14T07:19:48Z")

</div>

Thanks, BramVanroy  
I think this documentation is for PyTorch and I am currently using TensorFlow.  
So that means there is no such solution now in TensorFlow

---

<div class="post-metadata">

**Author:** ![BramVanroy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bramvanroy/32/47360_2.png) [@BramVanroy](https://discuss.huggingface.co/u/BramVanroy)\
**Post date:** [April 14, 2022, 8:56am UTC](https://discuss.huggingface.co/t/saving-weights-and-checkpoints/16788/4 "2022-04-14T08:56:00Z")

</div>

I am no familiar with the TF code base of the libraries, but it seems that some checkpointing is implemented:

> <https://github.com/huggingface/transformers/blob/195fbbb6cfc6c6279cef6be12b05a53d589b0de8/src/transformers/trainer_tf.py#L502-L526>

Maybe someone else can chime in, who knows more about TF.
