# Gap Sentences Generation using Pegasus

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgap-sentences-generation-using-pegasus%2F21560%3E%5C
**Category:** Beginners\
**Created:** [August 12, 2022, 1:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgap-sentences-generation-using-pegasus%2F21560 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FWonderYear1905)%5C
**Post date:** [August 12, 2022, 1:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgap-sentences-generation-using-pegasus%2F21560%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FEwanwong)%5C
**Post date:** [March 6, 2024, 2:29pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgap-sentences-generation-using-pegasus%2F21560%2F2 "2024-03-06T14:29:11Z")

</div>

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