export_model模型转换出错
Created by: ly7969
export CUDA_VISIBLE_DEVICES=0
python -m paddle.distributed.launch
--selected_gpus="0"
tools/train.py
-c ./configs/quick_start/ResNet50_vd.yaml
使用上述命令训练模型后,然后通过export_model转换模型 python tools/export_model.py --model=ResNet50_vd --pretrained_model=output/ResNet50_vd/19/ --output_path=inference/ResNet50_vd --class_dim=102
报错 2020-05-09 14:36:17,701-WARNING: output/ResNet50_vd/19/.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] 2020-05-09 14:36:17,701-WARNING: output/ResNet50_vd/19/.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] 2020-05-09 14:36:17,703-WARNING: variable file [ output/ResNet50_vd/19/ppcls.pdopt output/ResNet50_vd/19/ppcls.pdparams output/ResNet50_vd/19/ppcls.pdmodel ] not used 2020-05-09 14:36:17,703-WARNING: variable file [ output/ResNet50_vd/19/ppcls.pdopt output/ResNet50_vd/19/ppcls.pdparams output/ResNet50_vd/19/ppcls.pdmodel ] not used /home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py:804: UserWarning: There are no operators in the program to be executed. If you pass Program manually, please use fluid.program_guard to ensure the current Program is being used. warnings.warn(error_info) /home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py:782: UserWarning: The following exception is not an EOF exception. "The following exception is not an EOF exception.") Traceback (most recent call last): File "tools/export_model.py", line 78, in main() File "tools/export_model.py", line 74, in main params_filename='params') File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 1245, in save_inference_model save_persistables(executor, save_dirname, main_program, params_filename) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 640, in save_persistables filename=filename) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 295, in save_vars filename=filename) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 350, in save_vars executor.run(save_program) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 783, in run six.reraise(*sys.exc_info()) File "/home/lishi/anaconda3/lib/python3.7/site-packages/six.py", line 703, in reraise raise value File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 778, in run use_program_cache=use_program_cache) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 831, in _run_impl use_program_cache=use_program_cache) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/executor.py", line 905, in _run_program fetch_var_name) paddle.fluid.core_avx.EnforceNotMet:
C++ Call Stacks (More useful to developers):
0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const*, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int) 2 paddle::framework::Tensor::type() const 3 paddle::operators::SaveCombineOpKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const 4 std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::SaveCombineOpKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::SaveCombineOpKernel<paddle::platform::CPUDeviceContext, double>, paddle::operators::SaveCombineOpKernel<paddle::platform::CPUDeviceContext, int>, paddle::operators::SaveCombineOpKernel<paddle::platform::CPUDeviceContext, long> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) 5 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const 6 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const 7 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) 8 paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) 9 paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, std::vector<std::string, std::allocatorstd::string > const&, bool, bool)
Python Call Stacks (More useful to users):
File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2525, in append_op attrs=kwargs.get("attrs", None)) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 343, in save_vars 'save_to_memory': save_to_memory File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 295, in save_vars filename=filename) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 640, in save_persistables filename=filename) File "/home/lishi/anaconda3/lib/python3.7/site-packages/paddle/fluid/io.py", line 1245, in save_inference_model save_persistables(executor, save_dirname, main_program, params_filename) File "tools/export_model.py", line 74, in main params_filename='params') File "tools/export_model.py", line 78, in main()
Error Message Summary:
Error: Tensor not initialized yet when Tensor::type() is called. [Hint: holder_ should not be null.] at (/paddle/paddle/fluid/framework/tensor.h:140) [operator < save_combine > error]