gpt4 book ai didi

python - key 错误 : "Unknown task summarization, available tasks are [' feature-extraction', 'sentiment-analysis' 、 'ner' 、 'question-answering' 、 'fill-mask' ]"

转载 作者:行者123 更新时间:2023-12-04 08:35:43 25 4
gpt4 key购买 nike

我正在尝试对该数据框中的一列进行文本摘要。我按照本网站( https://towardsdatascience.com/summarization-of-covid-research-papers-using-bart-model-5b109a6669a6 )中提到的步骤进行操作,但出现此错误
KeyError:“未知任务摘要,可用任务是 ['特征提取'、'情感分析'、'ner'、'问题回答'、'填充掩码']”
Screenshot of Error

最佳答案

你应该更新你的变压器库:

pip install -U transformers

from transformers import pipeline

# use bart in pytorch
summarizer = pipeline("summarization")
summarizer("An apple a day, keeps the doctor away", min_length=5, max_length=20)

# use t5 in tf
summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-base", framework="tf")
summarizer("An apple a day, keeps the doctor away", min_length=5, max_length=20)

关于python - key 错误 : "Unknown task summarization, available tasks are [' feature-extraction', 'sentiment-analysis' 、 'ner' 、 'question-answering' 、 'fill-mask' ]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64813278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com