# Using generate() method with decoder

**URL:** <https://discuss.huggingface.co/t/using-generate-method-with-decoder/13750>\
**Category:** Models\
**Created:** [January 16, 2022, 11:21am UTC](https://discuss.huggingface.co/t/using-generate-method-with-decoder/13750 "2022-01-16T11:21:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![utsavdutta98](https://avatars.discourse-cdn.com/v4/letter/u/b9e5f3/32.png) [@utsavdutta98](https://discuss.huggingface.co/u/utsavdutta98)\
**Post date:** [January 16, 2022, 11:21am UTC](https://discuss.huggingface.co/t/using-generate-method-with-decoder/13750/1 "2022-01-16T11:21:13Z")

</div>

How does one use the model.generate() method in BART, with just the decoder?  
Is it possible to take the encoder outputs, and feed it into the BART decoder, and use the generate method on just the decoder? If possible, could you provide a code snippet for the same?

Thanks
