You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

加载Pegasus文本摘要模型时出现AttributeError错误求助

加载Pegasus文本摘要模型时出现AttributeError错误求助

大家好,我最近在尝试用Pegasus模型做文本摘要的时候碰到了个棘手的问题,折腾半天没解决,来请教下各位!

我运行的代码是这样的:

from transformers import pipeline, set_seed
pipe = pipeline("summarization", model="google/pegasus-cnn_dailymail")

结果直接抛出了这个错误:

AttributeError: 'NoneType' object has no attribute 'encode'

对应的报错堆栈片段是:

1588     logger.info("Converting from Tiktoken")
   1589     return TikTokenConverter(
   1590         vocab_file=transformer_tokenizer.vocab_file,
   1591         additional_special_tokens=transformer_tokenizer.additional_special_tokens,
-> 1592     ).converted()
   1593 except Exception:

我已经试过安装tiktoken包,而且重启了运行内核,但还是会出现一模一样的错误,有没有大佬能帮忙分析下问题出在哪呀?

备注:内容来源于stack exchange,提问作者coolhand

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 15:19:29