Reproduce the summarization pipeline.

#3
by fwz - opened

from transformers import pipeline
pipe = pipeline("summarization", model="achimoraites/flan-t5-base-samsum")

Like the above code, I am able to obtain the summary output. However, the output is shorter and not as good as the API's output. Are there any additional settings or parameters that could be used to improve the results? I would greatly appreciate any suggestions.

You could play with the following parameters

max_length, min_length, num_beams

EXAMPLE

summarizer = pipeline("summarization", model="achimoraites/flan-t5-base-samsum")

def summarize(text):
    return summarizer(text, max_length=128, min_length=30, num_beams=4)[0]['summary_text']

I hope that helps!

Sign up or log in to comment