New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: "PretrainedConfig instance not found in the arguments, you can set it as args or kwargs with config field" ValueError: PretrainedConfig instance not found in the arguments, you can set it as args or kwargs with config field #4345
Comments
2.4.9 版本的 from_pretrained 有不兼容升级,建议仍使用2.4.5进行动转静 |
好吧 |
@datalee
|
没的用,改成这样也不行:
|
请问是哪一行报错了?麻烦发一下error stack |
|
从日志里看,这个config被加载了两次,看起来不太对劲。您如果单独跑 |
跑不通,和自定义的是一样的error stack |
掉两次是因为我单独用PretrainedConfig.from_pretrained加载了次config,这个可以忽略
|
这个有点奇怪, 我用v2.4.9跑 |
那就是不兼容低版本的模型了? |
我先降到paddlenlp-2.4.5吧,2.4.5就没问题[泪哭] |
我刚才用2.4.5保存的模型,用2.4.9的paddlenlp读取,也没有任何问题
如果您在2.4.9里跑不通 |
问题出在UIE模型的定义上,我使用是之前自定义的model
当我直接从from paddlenlp.transformers import UIE时,不会报上面的错误了,但是加载自定义的模型会出现参数无法初始化的问题:
|
@datalee
|
好的,明白了,感谢 |
我也遇到了同样的问题,我想问一下,2.4.9中通过下面语句加载的UIE模型,与2.4.2版本model文件中的UIE模型有什么区别?
|
在2.4.2版本中,因为UIE刚刚开源,所以并未纳入 |
模型加载我倒是没遇到啥问题,使用 |
都是0的话,可以仔细看一下模型加载进来有没有warning。有可能权重没对上,导致最后模型是from scratch的 |
你说得对,确实加载的时候出现了和上面的老哥相同的问题,所以我训练的时候前面的epoch评估一直是0,大概10个epoch后就开始有结果了。
我想问一下,finetune这块的代码,之前是这样去加载的(此处的UIE是之前自定义的model)
现在我的UIE模型更改为
|
可以使用这个语句,不过需要根据我上面的一个评论提到的处理一下老的权重,就能正确加载了 |
我在使用的过程中发现,除了
|
不客气~ |
软件环境
重复问题
错误描述
模型文件包含以下内容,是在2.4.5版本下训练的:
model_config.json
model_state.pdparams
special_tokens_map.json
tokenizer_config.json
vocab.txt
from model import UIE
parser = argparse.ArgumentParser()
parser.add_argument("--model_path", type=str, required=True, default='./checkpoint/model_best', help="The path to model parameters to be loaded.")
parser.add_argument("--output_path", type=str, default='./export', help="The path of model parameter in static graph to be saved.")
args = parser.parse_args()
if name == "main":
model = UIE.from_pretrained(args.model_path)
model.eval()
The text was updated successfully, but these errors were encountered: