# Difference between AutoModel and AutoModelForLM

**URL:** <https://discuss.huggingface.co/t/difference-between-automodel-and-automodelforlm/5967>\
**Category:** Beginners\
**Created:** [May 4, 2021, 8:49am UTC](https://discuss.huggingface.co/t/difference-between-automodel-and-automodelforlm/5967 "2021-05-04T08:49:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tejan-rgb](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tejan-rgb](https://discuss.huggingface.co/u/tejan-rgb)\
**Post date:** [May 4, 2021, 8:49am UTC](https://discuss.huggingface.co/t/difference-between-automodel-and-automodelforlm/5967/1 "2021-05-04T08:49:22Z")

</div>

What is the difference between downloading a model using `AutoModel.from_pretrained(model_name)` and `AutoModelForLM.from_pretrained(model_name)` ?

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [May 4, 2021, 12:17pm UTC](https://discuss.huggingface.co/t/difference-between-automodel-and-automodelforlm/5967/2 "2021-05-04T12:17:38Z")

</div>

The first one will give you the bare pretrained model, while the second one will have a head attached to do language modeling. Note that `AutoModelForLM` is deprecated, you should use `AutoModelForCausalLM`, `AutoModelForMaskedLM` or `AutoModelForSeq2SeqLM` depending on the task at hand.

---

<div class="post-metadata">

**Author:** ![tejan-rgb](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tejan-rgb](https://discuss.huggingface.co/u/tejan-rgb)\
**Post date:** [May 4, 2021, 2:38pm UTC](https://discuss.huggingface.co/t/difference-between-automodel-and-automodelforlm/5967/3 "2021-05-04T14:38:59Z")

</div>

Thank You.
