# Do you train all layers when fine-tuning T5?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdo-you-train-all-layers-when-fine-tuning-t5%2F1034%3E%5C
**Category:** Beginners\
**Created:** [September 8, 2020, 4:04am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdo-you-train-all-layers-when-fine-tuning-t5%2F1034 "2020-09-08T04:04:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![valhalla](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/valhalla/32/4179_2.png) [@valhalla](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvalhalla)%5C
**Post date:** [September 8, 2020, 6:04am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdo-you-train-all-layers-when-fine-tuning-t5%2F1034%2F2 "2020-09-08T06:04:39Z")

</div>

I haven’t seen much experiments for this, but IMO it’s better to fine-tune the whole model.

Also when you pass `labels` argument to `T5ForConditionalGeneration`'s `forward` method then it calculates the loss for you and returns it as the first value in the returned `tuple` .

And you can use the `finetune.py` script [here](https://github.com/huggingface/transformers/tree/master/examples/seq2seq) to fine-tuning T5 and other seq2seq models

See this thread [T5 Finetuning Tips](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ft5-finetuning-tips%2F684)

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdo-you-train-all-layers-when-fine-tuning-t5%2F1034)._
