使用 Pegasus-t5 预训练模型遇到问题解决

文章关注在使用中文摘要模型T5-Pegasus时遇到的tokenizer问题,提供了解决方案和下载步骤。

背景

因为大模型之前,中文摘要效果比较好的模型就是t5-pegasus,在huggingface上的预训练模型,down下来使用遇到两个问题。

问题&解决

  1. 需要手动把tokenizer相关文件进行调整到当前文件夹下,并修改data_utils 中fengshen的地址
  2. transformers 版本降低为4.29.1 否则会找不到vocab

demo 代码


from transformers import PegasusForConditionalGeneration
# Need to download tokenizers_pegasus.py and other Python script from Fengshenbang-LM github repo in advance,
# or you can download tokenizers_pegasus.py and data_utils.py in https://huggingface.co/IDEA-CCNL/Randeng_Pegasus_523M/tree/main
# Strongly recommend you git clone the Fengshenbang-LM repo:
# 1. git clone https://github.com/IDEA-CCNL/Fengshenbang-LM
# 2. cd Fengshenbang
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值