# Different Trainers, when to use which?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdifferent-trainers-when-to-use-which%2F48481%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 28, 2023, 7:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdifferent-trainers-when-to-use-which%2F48481 "2023-07-28T07:19:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alvations](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alvations/32/97_2.png) [@alvations](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Falvations)%5C
**Post date:** [July 28, 2023, 7:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdifferent-trainers-when-to-use-which%2F48481%2F1 "2023-07-28T07:19:58Z")

</div>

There’s a few `*Trainer` objects available from `transformers`, `trl` and `setfit`.

Other than the standard answer of “_it depends on the task and which library you want to use_”, **what is the best practice or general guidelines when choosing which `*Trainer` object to use to train/tune our models?**

Together with the `*Trainer` object, sometimes we see suggestions to use `*TrainingArguments` or the vanilla `TrainingArguments`.

* * *

For reference, we have:

- **fine-tuning llama** ,
  - [https://github.com/philschmid/huggingface-llama-2-samples/blob/master/training/scripts/run\_clm.py](https://github.com/philschmid/huggingface-llama-2-samples/blob/master/training/scripts/run_clm.py) suggests vanilla `Trainer`

- **few-shot learning** ,
  - [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) suggests `from setfit import SetFitTrainer `

- **machine translation**
  - [https://github.com/huggingface/transformers/blob/main/examples/pytorch/translation/run\_translation.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/translation/run_translation.py) suggests `Seq2SeqTrainer`

- **reinforcement learning**
  - [Supervised Fine-tuning Trainer](https://huggingface.co/docs/trl/main/en/sft_trainer) suggests `from trl import SFTTrainer`

---

<div class="post-metadata">

**Author:** ![ai-nikolai](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ai-nikolai/32/32811_2.png) [@ai-nikolai](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fai-nikolai)%5C
**Post date:** [October 12, 2024, 2:39pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdifferent-trainers-when-to-use-which%2F48481%2F2 "2024-10-12T14:39:56Z")

</div>

@alvations is there any update on this?

@philschmid Are there any resources you could recommend? Or people we could tag?
