Open tianrenheyi09 opened 2 years ago
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~
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 API,FAQ,Github Issue and AI community to get the answer.Have a nice day!
请问使用什么版本的Paddle和环境?有详细的错误信息吗?
paddle1.8,提示变量不存在
INFO 2022-07-22 17:57:43,665 dataloader_auto_checkpoint.py:157] end dataloader epoch_no:0
Traceback (most recent call last):
File "test5.py", line 135, in
fluid.io.save_inference_model(dirname="./modelm", feeded_var_names=['image'], target_vars=[train_loss], executor=exe)
File "/opt/_internal/cpython-3.7.0/lib/python3.7/site-packages/paddle/fluid/io.py", line 1250, in save_inference_model
prepend_feed_ops(main_program, feeded_var_names)
File "/opt/_internal/cpython-3.7.0/lib/python3.7/site-packages/paddle/fluid/io.py", line 1046, in prepend_feed_ops
out = global_block.var(name)
File "/opt/_internal/cpython-3.7.0/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2392, in var
raise ValueError("var %s not in this block" % name)
ValueError: var image not in this block
for epoch_id in six.moves.range(1): run_iterable(train_prog, exe, train_loss, train_loader)
fluid.io.save_inference_model(dirname="./modelm", feeded_var_names=['image'], target_vars=[train_loss], executor=exe)
你好,能贴一段可复现的代码吗?
你好,请设置一下save_inference_model的main_program参数
多谢,添加main_program参数后,可以正常保存
bug描述 Describe the Bug
https://www.paddlepaddle.org.cn/documentation/docs/zh/1.8/advanced_guide/data_preparing/static_mode/use_py_reader.html paddle官网的异步读取数据的范例代码中,无法使用save_inference保存模型 在以上实例代码中,每个epoch加上保存模型的代码,报错 fluid.io.save_inference_model(dirname="./modelm", feeded_var_names=['image'], target_vars=[train_loss], executor=exe)
其他补充信息 Additional Supplementary Information
No response