PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.09k stars 5.55k forks source link

DuReader paddlepaddle版本加载模型报错 #30799

Closed weizhenzhao closed 1 year ago

weizhenzhao commented 3 years ago

非常感谢您提交关于飞桨文档的Issue,我们会认真听取您的意见,并进行改进。

建立issue时,为快速解决问题,请您根据情况给出如下信息:

文档问题描述:

你好,我在使用那个百度那个DuReader 开源的代码,训练完后,进行预测的时候,报那个,下面这个错误 paddle.fluid.core.EnforceNotMet: Cannot open file models/4/4\pn_decoder:fw:static_rnn:_lstm_f_b for load op at [E:\dist\Paddle\paddle\fluid\operators\load_op.cc:39]

https://github.com/baidu/DuReader/blob/master/paddle/run.py

那个加载模型的时候,它是这样写的 image 那个保存模型的时候,它是这样写的 image

详细的模型代码,参考下面这个链接 https://github.com/baidu/DuReader/blob/master/paddle/rc_model.py

我在怀疑是否是保存模型的时候,少保存哪些东西,我试着改成那个fluid.io.save_inference_model .还是报上面那个错误。

希望您能帮忙看看,感激不尽

API文档描述是否清晰?

如:文档描述看不懂,不知道这个API该怎么用;文档公式错误;

参数说明是否清晰

如:参数未解释清楚,包括用法、使用场景、默认值等

返回/形状说明是否清晰

如:API返回值、数据的形状描述错误、不清楚

示例代码是否有效?

如:没有示例代码;示例代码没有可指导性;示例代码跑不通;示例代码格式有问题;示例代码没有注释;

中英文内容是否一致?

如:中英文API描述不一致;中英文API参数不一致;

其他

如:文档页面打不开;文档缺失;文档中有死链;

Thanks for opening a document issue. We will listen to your opinions carefully and make improvements.

In order to quickly solve your problem, when creating an issue, please provide the following information: Document Information

Describe the problem:

Document description is clear?

For example: I don’t understand this document, I don’t know how to use this API; The formula in this doc is unclear;

Parameter description is clear?

For example: The parameters are confusing, including usage, scenarios, default values, etc.

Return/Shape description is clear

For example: Data returned this doc is error, shape returned is not clear.

The sample code is clear?

For example: no sample code; The sample code is not helpful; The sample code not run well; Format of the sample is not reasonable; The sample code has no comments.

Chinese content and English content is consistent?

For example:Chinese API in this doc is inconsistent with English API, including params, description, sample code, formula, etc.

Other

For example: The doc link is broken; The doc page is missing; Dead link in docs.

paddle-bot-old[bot] commented 3 years ago

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

paddle-bot-old[bot] commented 3 years ago

【有奖问卷调查】感谢大家对飞桨的支持,现在飞桨技术团队想了解一下高校实验室的硬件使用情况,邀请您抽出10-15min 的时间来完成一个问卷调研,我们会认真考虑每个人的实验场景和大家反馈的问题,以便在飞桨框架对GPU等硬件资源的支持上作出进一步优化,完成问卷后我们会送出一份精美礼品作为感谢~ 问卷链接:https://paddle.wjx.cn/vj/YmeuTy1.aspx

qili93 commented 3 years ago

@weizhenzhao 请帮忙提供一下您的运行环境,Paddle版本,Python版本以及运行命令等信息。

weizhenzhao commented 3 years ago

使用那个DuReader paddle 的训练命令是那个 python run.py --train --pass_num 5 这个命令我是在linux 下面训练的上面有gpu 是那个paddlepaddle-gpu==1.2.0.post97 版本 训练完后,我把那个模型复制到windows的cpu笔记本上面 运行环境windows10 python3.6 paddle 版本是那个 1.2.0 cpu版本的 predict 的命令是那个 python run.py --predict --load_dir ../data/models/1

然后就报上面那错

qili93 commented 3 years ago

@weizhenzhao 你试一下指定 --save_dir看看,看run.py里面的定义的model_path是由save_dir指定的 image

weizhenzhao commented 3 years ago
parser.add_argument("--save_dir", type=str, default="../data/models",
                    help="Specify the path to save trained models.")

save_dir 写了是默认这个../data/models 。 后来为了区分每次epoch 保存的模型我在后面加了一个epoch_id if pass_id % args.save_interval == 0: model_path = os.path.join(args.save_dir, str(pass_id))

                if not os.path.isdir(model_path):
                    os.makedirs(model_path)
weizhenzhao commented 3 years ago

就是训练完后在linux 下面去predict 没有问题, 把模型复制到windows paddle1.2.0 上面去执行就有问题了。

qili93 commented 3 years ago

@weizhenzhao 那你稍等下,我需要问下当前这个模型是否有QA在Windows上验证过。

qili93 commented 3 years ago

@weizhenzhao 对了,你试试看把load_dir和save_dir对应到windows的完整路径呢?linux上可以,但是windows上不可以的话,感觉像是路径不对造成的,你试试比如输入'D:\users\xxx'类似这种绝对路径格式,保证windows上可以找到模型和参数文件

weizhenzhao commented 3 years ago

模型应该是找得到的,因为我把那个load_dir 乱写,的时候,它报的错是说找不到embedding_param 那个错,不是上面的那个错。 而且我怀疑这个东西,好像必须得有gpu才好用,昨天下午我在阿里云上面租了一个cpu 版本的linux 机器,试了一下还是这个错。

qili93 commented 3 years ago

@weizhenzhao 你有尝试把--use_gpu关掉吗?

weizhenzhao commented 3 years ago

试过了,不好用

weizhenzhao commented 3 years ago

我在想会不会是那个protobuf 的版本不一样导致的,linux上面那个protobuf==3.11.0 windows上面的是3.1.0