# LM few shot and fine tuning on summarization task

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Flm-few-shot-and-fine-tuning-on-summarization-task%2F1424%3E%5C
**Category:** Beginners\
**Created:** [October 8, 2020, 12:29pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Flm-few-shot-and-fine-tuning-on-summarization-task%2F1424 "2020-10-08T12:29:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcoabrate](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/marcoabrate/32/441_2.png) [@marcoabrate](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmarcoabrate)%5C
**Post date:** [October 8, 2020, 12:29pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Flm-few-shot-and-fine-tuning-on-summarization-task%2F1424%2F1 "2020-10-08T12:29:15Z")

</div>

hello there,

i am new to the forum and to nlp in general. i start this topic to try to understand more about language models and how huggingface can be used for few shot learning and fine tuning.

i am interested in the text summarization task. i know there are already some pre trained models such as BART, T5 and Pegasus that perform summarization quite well and i have already played with them using the huggingface transformers library. i know there are some community notebooks such as [this](https://github.com/ohmeow/ohmeow_website/blob/master/_notebooks/2020-05-23-text-generation-with-blurr.ipynb) and [that](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb), and the GitHub issue #4406 (could not link it since i am new) on how to fine tune these models for more specific summarization tasks that differ from the common CNN/dailymail corpus.

what i am here to understand more is how to use a generic LM for text summarization. T5 and BART have a ForConditionalGeneration class. however, models like BERT, flauBERT, gpt, gpt2, XLM do not have this class, but only a LM head. i have read the gpt3 LM can perform any given task by just “looking” at some examples. i am wondering if there is a way to do the same with the LM i have just cited. moreover, most of the summarization discussions are focused on BART and T5 and i could not find any guide on how to actually fine tune generic LM models (BERT, flauBERT, gpt, gpt2, XLM, etc.) on such a task.

i have used gpt2 for text summarization by feeding the article and then the string “TL;DR:”, but the results are quite bad.

😅 TL;DR: in synthesis, my questions are: how can i do few shot learning on summarization with LM models such as gpt2 that only have a LM head class, using huggingface? how can i properly fine tune them on such a task?

P.S. the huggingface transformers library is amazing, i hope the community will keep on thriving!

---

<div class="post-metadata">

**Author:** ![ronnys](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@ronnys](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fronnys)%5C
**Post date:** [July 19, 2024, 9:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Flm-few-shot-and-fine-tuning-on-summarization-task%2F1424%2F2 "2024-07-19T09:15:42Z")

</div>

Hello i am new to the community.  
Do you still learn and work in the hugging face ecosystem
