Hi @pratikbhavsar @sshleifer !
I want to implement the first approach but I have a question.
Here is my function for combining the top K sentences from the extractive summarization.
def concat_sentences_till_max_length(top_n_sentences, max_length):
  text = ''

  for s in top_n_sentences:
      if len(text + " " + s) <= max_length:
          text = text + " " + s

  return text

However, I don’t know how to the get the max input length of the abstractive summarizer.
I am using a summarization pipeline and I want to make it work for any transformers model.
Is the following the correct way to do it?
pipe = pipeline("summarization", model=model, framework='pt')
document = concat_sentences_till_max_length(top_n_sentences, pipe.model.config.max_length)