创建多个 name不同的pyreader时报错
Created by: littlepan0413
描述:修改了ernie模型,模型中finetune和预测接口都有,在test中先finetune,再predict,两个接口单独测试过没有问题,但是放在同一个文件夹中运行报错,主要是 pyreader创建的问题, finetune中的两个pyreader 预测使用的pyreader(报错)
查阅 issue,https://github.com/PaddlePaddle/Paddle/issues/16759 三个pyreader_name 已设置不同
报错信息 File "/home/work/panlu/workspace/baidu/kgx/models/baidu/kgx/models/mt_ernie_classifier.py", line 86, in init self.__start_model() File "/home/work/panlu/workspace/baidu/kgx/models/baidu/kgx/models/mt_ernie_classifier.py", line 104, in __start_model ernie_config=self.__ernie_config, tasks_num=self.__tasks_def.tasks_num, is_classify=True) File "/home/work/panlu/workspace/baidu/kgx/models/baidu/kgx/models/mt_ernie_utils/finetune/classifier.py", line 46, in create_model use_double_buffer=True) File "/home/work/anaconda2/envs/paddle_gpu/lib/python2.7/site-packages/paddle/fluid/layers/io.py", line 800, in py_reader use_double_buffer=use_double_buffer) File "/home/work/anaconda2/envs/paddle_gpu/lib/python2.7/site-packages/paddle/fluid/layers/io.py", line 537, in _py_reader feed_queue = core.init_lod_tensor_blocking_queue(var, capacity) paddle.fluid.core_avx.EnforceNotMet: LoDTensorBlockingQueueHolder::InitOnce() can only be called once at [/paddle/paddle/fluid/operators/reader/lod_tensor_blocking_queue.h:77] PaddlePaddle Call Stacks: 0 0x7f16ca862e10p void paddle::platform::EnforceNotMet::Init<char const*>(char const*, char const*, int) + 352 1 0x7f16ca863189p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 137 2 0x7f16ca86cc42p paddle::operators::reader::LoDTensorBlockingQueueHolder::InitOnce(unsigned long, bool) + 242 3 0x7f16ca849f3fp 4 0x7f16ca895d36p 5 0x7f1728b6d274p PyEval_EvalFrameEx + 32020 6 0x7f1728b6ea99p PyEval_EvalCodeEx + 2025 7 0x7f1728b6bf68p PyEval_EvalFrameEx + 27144 8 0x7f1728b6ea99p PyEval_EvalCodeEx + 2025 9 0x7f1728b6bf68p PyEval_EvalFrameEx + 27144 10 0x7f1728b6ea99p PyEval_EvalCodeEx + 2025 11 0x7f1728b6bf68p PyEval_EvalFrameEx + 27144 12 0x7f1728b6ea99p PyEval_EvalCodeEx + 2025 13 0x7f1728b6bf68p PyEval_EvalFrameEx + 27144 14 0x7f1728b6ea99p PyEval_EvalCodeEx + 2025 15 0x7f1728af77c7p 16 0x7f1728ad2b73p PyObject_Call + 67 17 0x7f1728ae1a4dp 18 0x7f1728ad2b73p PyObject_Call + 67 19 0x7f1728b2ba84p 20 0x7f1728b2833bp 21 0x7f1728ad2b73p PyObject_Call + 67 22 0x7f1728b69119p PyEval_EvalFrameEx + 15289 23 0x7f1728b6d54ep PyEval_EvalFrameEx + 32750 24 0x7f1728b6d54ep PyEval_EvalFrameEx + 32750 25 0x7f1728b6ea99p PyEval_EvalCodeEx + 2025 26 0x7f1728b6ecbap PyEval_EvalCode + 26 27 0x7f1728b8801dp 28 0x7f1728b891c8p PyRun_FileExFlags + 120 29 0x7f1728b8a3e8p PyRun_SimpleFileExFlags + 232 30 0x7f1728b9c67cp Py_Main + 2988 31 0x7f1727d85b45p __libc_start_main + 245 32 0x7f1728c6e07fp