models/PaddleNLP/sentiment_classification/ 模型保存问题
Created by: ML-ZXF
使用Ernie 训练模型后 执行模型部署保存的命令 sh run_ernie.sh save_inference_model 出现Tensor未初始化的错误 按照教程里的参数结合本地文件位置做了修改 还需要改什么地方吗? ['/home/ubuntu/python3.6_Project/zxf_Project/models/PaddleNLP/sentiment_classification', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages', '../shared_modules/', '../shared_modules/models/classification', '../shared_modules/models/classification/', '../shared_modules/'] ----------- Configuration Arguments ----------- batch_size: 4 checkpoints: checkpoints data_dir: None dev_set: None do_infer: True do_lower_case: True do_save_inference_model: True do_train: True do_val: True enable_ce: False epoch: 10 ernie_config_path: ./pretrain_models/ernie/ernie_config.json inference_model_dir: ./inference_model init_checkpoint: ./save_models/step_4801/ label_map_config: None lr: 0.002 max_seq_len: 512 model_type: ernie_base num_labels: 2 random_seed: 0 save_steps: 10000 senta_config_path: None skip_steps: 10 task_name: None test_set: ./senta_data/test.tsv train_set: None use_cuda: True use_paddle_hub: False validation_steps: 1000 verbose: False vocab_path: ./pretrain_models/ernie/vocab.txt
attention_probs_dropout_prob: 0.1 hidden_act: relu hidden_dropout_prob: 0.1 hidden_size: 768 initializer_range: 0.02 max_position_embeddings: 513 num_attention_heads: 12 num_hidden_layers: 12 type_vocab_size: 2 vocab_size: 18000
W0811 11:36:57.896898 10516 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 75, Driver API Version: 10.2, Runtime API Version: 10.0 W0811 11:36:57.900704 10516 device_context.cc:260] device: 0, cuDNN Version: 7.6. 2020-08-11 11:37:03,045-WARNING: ./save_models/step_4801/.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] 2020-08-11 11:37:03,048-WARNING: variable file [ ./save_models/step_4801/checkpoint.pdmodel ./save_models/step_4801/checkpoint.pdparams ./save_models/step_4801/checkpoint.pdopt ] not used /home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/executor.py:1093: 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) Load model from ./save_models/step_4801/ /home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/executor.py:1070: UserWarning: The following exception is not an EOF exception. "The following exception is not an EOF exception.") Traceback (most recent call last): File "inference_model_ernie.py", line 153, in do_save_inference_model(args) File "inference_model_ernie.py", line 71, in do_save_inference_model params_filename="params.pdparams") File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 1270, in save_inference_model save_persistables(executor, save_dirname, main_program, params_filename) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 647, in save_persistables filename=filename) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 301, in save_vars filename=filename) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 356, in save_vars executor.run(save_program) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/executor.py", line 1071, in run six.reraise(*sys.exc_info()) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/executor.py", line 1066, in run return_merged=return_merged) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/executor.py", line 1154, in _run_impl use_program_cache=use_program_cache) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/executor.py", line 1229, 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::operators::SaveCombineOpKernel<paddle::platform::CUDADeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const 3 std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CUDAPlace, false, 0ul, paddle::operators::SaveCombineOpKernel<paddle::platform::CUDADeviceContext, float>, paddle::operators::SaveCombineOpKernel<paddle::platform::CUDADeviceContext, double>, paddle::operators::SaveCombineOpKernel<paddle::platform::CUDADeviceContext, int>, paddle::operators::SaveCombineOpKernel<paddle::platform::CUDADeviceContext, long> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1 (closed)}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) 4 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const 5 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const 6 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) 7 paddle::framework::Executor::RunPartialPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, long, long, bool, bool, bool) 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/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2610, in append_op attrs=kwargs.get("attrs", None)) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 349, in save_vars 'save_to_memory': save_to_memory File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 301, in save_vars filename=filename) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 647, in save_persistables filename=filename) File "/home/ubuntu/.virtualenvs/zxf_env/lib/python3.6/site-packages/paddle/fluid/io.py", line 1270, in save_inference_model save_persistables(executor, save_dirname, main_program, params_filename) File "inference_model_ernie.py", line 71, in do_save_inference_model params_filename="params.pdparams") File "inference_model_ernie.py", line 153, in do_save_inference_model(args)
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]