# Text classification and generation from the same model

**URL:** <https://discuss.huggingface.co/t/text-classification-and-generation-from-the-same-model/25404>\
**Category:** Beginners\
**Created:** [November 2, 2022, 10:43am UTC](https://discuss.huggingface.co/t/text-classification-and-generation-from-the-same-model/25404 "2022-11-02T10:43:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![StefanL](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stefanl/32/12357_2.png) [@StefanL](https://discuss.huggingface.co/u/StefanL)\
**Post date:** [November 2, 2022, 10:43am UTC](https://discuss.huggingface.co/t/text-classification-and-generation-from-the-same-model/25404/1 "2022-11-02T10:43:04Z")

</div>

Hi,

I’m looking for some advice on whether it is possible to fine-tune a model to both classify and generate text. I have a labelled dataset of text and have had success fine-tuning BERT and GTP-2 to predict the labels. I have also been able to successfully fine-tune multiple GPT-2 models to generate text of each label-type.

For various reasons, I would ideally like to make predictions and generate texts from the same fine-tuned model. Is this possible?

Any advice would be appreciated.

Stefan

---

<div class="post-metadata">

**Author:** ![Pranavagrl](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@Pranavagrl](https://discuss.huggingface.co/u/Pranavagrl)\
**Post date:** [July 27, 2023, 6:11am UTC](https://discuss.huggingface.co/t/text-classification-and-generation-from-the-same-model/25404/2 "2023-07-27T06:11:28Z")

</div>

Hi @StefanL, I am a beginner, and I was trying to fine-tune the model to generate text. It will be a great help if you will be able to provide your notebook to me.  
I am ready to use any model of the LlamaForCasualLM architecture; any dataset will be fine for me. I just want to understand the Concept and practical Implementation Behind that.
