senta_bilstm 在fine-tune的时候报错
Created by: wjmzjx
版本信息: paddle.version '1.8.3' paddlehub.version '1.8.0' win10
在运行PaddleHub/demo/senta/senta_finetune.py时报错
Error Message Summary:
InvalidArgumentError: The Tensor in the squeeze2 Op's Input Variable X(seq_len) is not initialized. [Hint: Expected t->IsInitialized() == true, but received t->IsInitialized():0 != true:1.] at (D:\1.8.3\paddle\paddle\fluid\framework\operator.cc:1289) [operator < squeeze2 > error]
Process finished with exit code 1
完整报错信息如下: E:\gl\sf\envs\python36\python.exe E:/Ss_working/Python_workSpace/fastNPLtest/check_pkg.py [2020-07-31 15:42:20,413] [ INFO] - Installing senta_bilstm module [2020-07-31 15:42:20,495] [ INFO] - Module senta_bilstm already installed in C:\Users\Administrator.paddlehub\modules\senta_bilstm [2020-07-31 15:42:23,655] [ INFO] - Dataset C:\Users\Administrator.paddlehub\dataset\chnsenticorp already cached. [2020-07-31 15:42:23,792] [ INFO] - Dataset label map = {'0': 0, '1': 1} [2020-07-31 15:42:23,792] [ INFO] - Installing lac module [2020-07-31 15:42:23,794] [ INFO] - Module lac already installed in C:\Users\Administrator.paddlehub\modules\lac [2020-07-31 15:42:26,467] [ WARNING] - The parameter use_pyreader has been dropped! PaddleHub over v1.8.0 will use pyreader by default. [2020-07-31 15:42:26,467] [ INFO] - Checkpoint dir: ckpt_20200731154226 !!! The CPU_NUM is not specified, you should set CPU_NUM in the environment variable list. CPU_NUM indicates that how many CPUPlace are used in the current task. And if this parameter are set as N (equal to the number of physical CPU core) the program may be faster.
export CPU_NUM=8 # for example, set CPU_NUM as number of physical CPU core which is 8.
!!! The default number of CPU_NUM=1. [2020-07-31 15:42:26,546] [ INFO] - processing train data now... this may take a few minutes E:\gl\sf\envs\python36\lib\site-packages\paddle\fluid\clip.py:779: UserWarning: Caution! 'set_gradient_clip' is not recommended and may be deprecated in future! We recommend a new strategy: set 'grad_clip' when initializing the 'optimizer'. This method can reduce the mistakes, please refer to documention of 'optimizer'. warnings.warn("Caution! 'set_gradient_clip' is not recommended " [2020-07-31 15:43:01,224] [ INFO] - Strategy with warmup, linear decay, slanted triangle learning rate, weight decay regularization, E:\gl\sf\envs\python36\lib\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) [2020-07-31 15:43:01,225] [ INFO] - Try loading checkpoint from ckpt_20200731154226\ckpt.meta [2020-07-31 15:43:01,225] [ INFO] - PaddleHub model checkpoint not found, start from scratch... [2020-07-31 15:43:01,570] [ INFO] - PaddleHub finetune start E:\gl\sf\envs\python36\lib\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 "E:/Ss_working/Python_workSpace/fastNPLtest/check_pkg.py", line 52, in cls_task.finetune_and_eval() File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 945, in finetune_and_eval return self.finetune(do_eval=True) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 966, in finetune run_states = self._run(do_eval=do_eval) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 1212, in _run return_numpy=self.return_numpy) File "E:\gl\sf\envs\python36\lib\site-packages\paddle\fluid\executor.py", line 1071, in run six.reraise(*sys.exc_info()) File "E:\gl\sf\envs\python36\lib\site-packages\six.py", line 703, in reraise raise value File "E:\gl\sf\envs\python36\lib\site-packages\paddle\fluid\executor.py", line 1066, in run return_merged=return_merged) File "E:\gl\sf\envs\python36\lib\site-packages\paddle\fluid\executor.py", line 1154, in _run_impl use_program_cache=use_program_cache) File "E:\gl\sf\envs\python36\lib\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):
Windows not support stack backtrace yet.
Python Call Stacks (More useful to users):
File "E:\gl\sf\envs\python36\lib\site-packages\paddle\fluid\framework.py", line 2610, in append_op attrs=kwargs.get("attrs", None)) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\common\paddle_helper.py", line 191, in _copy_vars_and_ops_in_blocks to_block.append_op(**op_info) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\common\paddle_helper.py", line 299, in clone_program dest_program.global_block()) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 413, in _build_env self._base_main_program, for_test=False) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 545, in main_program self._build_env() File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 911, in load_checkpoint main_program=self.main_program) File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 384, in init_if_necessary if not self.load_checkpoint(): File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 960, in finetune self.init_if_necessary() File "E:\gl\sf\envs\python36\lib\site-packages\paddlehub\finetune\task\base_task.py", line 945, in finetune_and_eval return self.finetune(do_eval=True) File "E:/Ss_working/Python_workSpace/fastNPLtest/check_pkg.py", line 52, in cls_task.finetune_and_eval()
Error Message Summary:
InvalidArgumentError: The Tensor in the squeeze2 Op's Input Variable X(seq_len) is not initialized. [Hint: Expected t->IsInitialized() == true, but received t->IsInitialized():0 != true:1.] at (D:\1.8.3\paddle\paddle\fluid\framework\operator.cc:1289) [operator < squeeze2 > error]
Process finished with exit code 1
此外 senta_finetune.py中将feed_list = [inputs["words"].name]改动为feed_list = [inputs["text"].name] 不然报错 Traceback (most recent call last): File "E:/Ss_working/Python_workSpace/fastNPLtest/check_pkg.py", line 30, in feed_list = [inputs["words"].name] KeyError: 'words'