首页 PaddleNLP 帖子详情
源码运行:paddle.fluid.dygraph.jit中的create_program_from_desc
收藏
快速回复
PaddleNLP 问答NLP训练 300 0
源码运行:paddle.fluid.dygraph.jit中的create_program_from_desc
收藏
快速回复
PaddleNLP 问答NLP训练 300 0

在使用推荐的文本分类模型进行训练时,到保存模型出现问题。

出现问题的代码语句如下:

  program_desc, feed_names, fetch_names, parameters = tracer.create_program_desc(var_list, feed_prefix, out_vars,
                                                                                       fetch_prefix, tmp_prefix)

报错信息为:

发生异常: TypeError
 
create_program_desc(): incompatible function arguments. The following argument types are supported: 1. (self: paddle.fluid.libpaddle.ProgramDescTracer, arg0: List[paddle.fluid.libpaddle.VarBase], arg1: str, arg2: List[paddle.fluid.libpaddle.VarBase], arg3: str, arg4: str) -> Tuple[paddle::framework::ProgramDesc, List[str], List[str], List[paddle.fluid.libpaddle.VarBase]] Invoked with: , [Tensor(shape=[8, 512], dtype=int64, place=Place(gpu:0), stop_gradient=True, [[1 , 60 , 598 , ..., 0 , 0 , 0 ], [1 , 3400, 715 , ..., 8 , 82 , 2 ], [1 , 223 , 952 , ..., 0 , 0 , 0 ], ..., [1 , 53 , 1005, ..., 0 , 0 , 0 ], [1 , 53 , 1005, ..., 0 , 0 , 0 ], [1 , 53 , 1005, ..., 0 , 0 , 0 ]]), Tensor(shape=[8, 512], dtype=int64, place=Place(gpu:0), stop_gradient=True, [[0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], ..., [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0]])], 'feed_', [Tensor(shape=[8, 4], dtype=float32, place=Place(gpu:0), stop_gradient=False, [[0.08668622, 0.04745395, 0.95085216, 0.04610328], [0.59510773, 0.27774084, 0.07924560, 0.78684521], [0.06393106, 0.04479345, 0.95899802, 0.05026669], [0.77224016, 0.13105527, 0.12466575, 0.14244302], [0.09765695, 0.05526858, 0.95214921, 0.05004920], [0.09042265, 0.05290326, 0.95439661, 0.03649709], [0.08688617, 0.03743793, 0.94103616, 0.05768103], [0.78011197, 0.10431510, 0.16724584, 0.12284328]])], 'fetch_', 't_'
File "/root/codes/qp/ERNIE/text_classification/erniekit/common/jit_wenxin.py", line 74, in _trace_wenxin program_desc, feed_names, fetch_names, parameters = tracer.create_program_desc(var_list, feed_prefix, out_vars, File "/root/codes/qp/ERNIE/text_classification/erniekit/common/jit_wenxin.py", line 37, in trace out = _trace_wenxin(layer, inputs, phase="save_inference") File "/root/codes/qp/ERNIE/text_classification/erniekit/controller/dynamic_trainer.py", line 171, in save_models output, static_wenxin = WenxinTracedLayer.trace(self.original_model, File "/root/codes/qp/ERNIE/text_classification/trainer/custom_dynamic_trainer.py", line 127, in do_train self.save_models(steps, example) File "/root/codes/qp/ERNIE/text_classification/run_trainer.py", line 108, in run_trainer trainer.do_train() File "/root/codes/qp/ERNIE/text_classification/run_trainer.py", line 131, in run_trainer(_params) TypeError: create_program_desc(): incompatible function arguments. The following argument types are supported: 1. (self: paddle.fluid.libpaddle.ProgramDescTracer, arg0: List[paddle.fluid.libpaddle.VarBase], arg1: str, arg2: List[paddle.fluid.libpaddle.VarBase], arg3: str, arg4: str) -> Tuple[paddle::framework::ProgramDesc, List[str], List[str], List[paddle.fluid.libpaddle.VarBase]] Invoked with: , [Tensor(shape=[8, 512], dtype=int64, place=Place(gpu:0), stop_gradient=True, [[1 , 60 , 598 , ..., 0 , 0 , 0 ], [1 , 3400, 715 , ..., 8 , 82 , 2 ], [1 , 223 , 952 , ..., 0 , 0 , 0 ], ..., [1 , 53 , 1005, ..., 0 , 0 , 0 ], [1 , 53 , 1005, ..., 0 , 0 , 0 ], [1 , 53 , 1005, ..., 0 , 0 , 0 ]]), Tensor(shape=[8, 512], dtype=int64, place=Place(gpu:0), stop_gradient=True, [[0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], ..., [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0]])], 'feed_', [Tensor(shape=[8, 4], dtype=float32, place=Place(gpu:0), stop_gradient=False, [[0.08668622, 0.04745395, 0.95085216, 0.04610328], [0.59510773, 0.27774084, 0.07924560, 0.78684521], [0.06393106, 0.04479345, 0.95899802, 0.05026669], [0.77224016, 0.13105527, 0.12466575, 0.14244302], [0.09765695, 0.05526858, 0.95214921, 0.05004920], [0.09042265, 0.05290326, 0.95439661, 0.03649709], [0.08688617, 0.03743793, 0.94103616, 0.05768103], [0.78011197, 0.10431510, 0.16724584, 0.12284328]])], 'fetch_', 't_'

我并没有对源码进行任何修改,初步想法在于将tensor数据转换为varbase是否会有影响?

0
收藏
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户