# Gap Sentences Generation using Pegasus

**URL:** <https://discuss.huggingface.co/t/gap-sentences-generation-using-pegasus/21560>\
**Category:** Beginners\
**Created:** [August 12, 2022, 1:53pm UTC](https://discuss.huggingface.co/t/gap-sentences-generation-using-pegasus/21560 "2022-08-12T13:53:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WonderYear1905](https://avatars.discourse-cdn.com/v4/letter/w/c89c15/32.png) [@WonderYear1905](https://discuss.huggingface.co/u/WonderYear1905)\
**Post date:** [August 12, 2022, 1:53pm UTC](https://discuss.huggingface.co/t/gap-sentences-generation-using-pegasus/21560/1 "2022-08-12T13:53:26Z")

</div>

Hi, I’m trying to use pretrained Pegasus in order to predict mask sentences, as in the paper and git using [mask1].  
How to accomplish this wishful thinking is still a mystery for me, best I found so far is this snap of code:[Link](https://huggingface.co/docs/transformers/v4.21.1/en/model_doc/pegasus#transformers.PegasusModel.forward.example)  
But I’m having trouble understanding the example, why is the output (last\_hidden\_states.shape) [1,4,1024] 3 for the 3 words and one for ~~?  
Is there an option to not use the decoder\_inputs, i.e that the decoder will count on his prediction for next word?  
how can the input be constructed when there are multiple masked sentences, I cant find any example showing that.  
Thanks for your help!!~~

---

<div class="post-metadata">

**Author:** ![Ewanwong](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Ewanwong](https://discuss.huggingface.co/u/Ewanwong)\
**Post date:** [March 6, 2024, 2:29pm UTC](https://discuss.huggingface.co/t/gap-sentences-generation-using-pegasus/21560/2 "2024-03-06T14:29:11Z")

</div>

Have you figured out how to do that? I’m having the same issue
