我正在尝试使用来自转换器的管道来总结文本。但是我只能得到原始文本的截断文本。 我的代码是:
from transformers import pipeline
summarizer = pipeline("summarization")
summarizer("The present invention discloses a pharmaceutical composition comprising therapeutically effective amount of, or an extract consisting essentially therapeutically effective amount of at least one cannabinoid selected from the group consisting of: Cannabidiol (CBD) or a derivative thereof, Tetrahydrocannabinol (THC) or a derivative thereof, and any combination thereof, for use in the treatment of multiple myeloma (MM). The present invention further discloses methods and uses of the aforementioned composition.",
min_length=5, max_length=10)
输出为
[{'summary_text': ' The present invention discloses a pharmaceutical'}]
那只是分析文本的开头。我在做什么错了?
答案 0 :(得分:0)
您以max_length = 10作为参数,这意味着生成的文本的最大长度应不超过10个标记。通过增加此数字,生成的摘要将更长。