# How to do generation using encoder\_outputs

**URL:** <https://discuss.huggingface.co/t/how-to-do-generation-using-encoder-outputs/32746>\
**Category:** Models\
**Created:** [February 28, 2023, 8:43pm UTC](https://discuss.huggingface.co/t/how-to-do-generation-using-encoder-outputs/32746 "2023-02-28T20:43:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oran-G](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@oran-G](https://discuss.huggingface.co/u/oran-G)\
**Post date:** [February 28, 2023, 8:43pm UTC](https://discuss.huggingface.co/t/how-to-do-generation-using-encoder-outputs/32746/1 "2023-02-28T20:43:18Z")

</div>

Hi,  
I am using a T5ForConditionalGeneration model for its decoder while using an outside encoder. I access only the decoder by using the model forward call by model(encoder\_outputs=encoutputs, labels=label)

I want to generate new outputs without teacher forcing, and the vanilla way to do this appear to be model.generate(), but model.generate() only allows for “input\_ids”, not “encoder\_outputs”. how can I use “encoder\_outputs” for generation?
