renmada / t5-pegasus-pytorch

402 stars 61 forks source link

load base版本的时候出现了问题 #10

Closed demeiyan closed 3 years ago

demeiyan commented 3 years ago

load base版本的模型的时候出现了下面的问题,从网上找了解决方法,好像都不行

OSError: Unable to load weights from pytorch checkpoint file for '/data/fb89d9f5118442f2bfe51d4d0259b2a8/t5/t5_pegasus_torch/' at '/data/fb89d9f5118442f2bfe51d4d0259b2a8/t5/t5_pegasus_torch/pytorch_model.bin'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True

renmada commented 3 years ago

pytorch1.7.0 + transformers4.3.3 试试下面的代码

from transformers.models.mt5.modeling_mt5 import MT5ForConditionalGeneration model = MT5ForConditionalGeneration.from_pretrained(‘imxly/t5-pegasus')

demeiyan commented 3 years ago

我就是这样加载模型的,试了一下,应该是python的版本问题