PaddlePaddle1.6.2下动态图使用warmup报错
Created by: ViktorAxelsen
- 版本、环境信息: 1)PaddlePaddle版本:1.6.2 2)CPU:AI Studio 3)GPU:V100,AI Studio上的 4)系统环境:Python2.7
- 训练信息 1)单卡 2)16GB / 32GB 3)linear_lr_warmup
- 复现信息:环境就是AI Studio,代码为AI识虫比赛官方给的train.py代码
- 问题描述:动态图下,训练时使用linear_lr_warmup报错:
Traceback (most recent call last):
File "train.py", line 58, in
decayed_lr = fluid.layers.linear_lr_warmup(learning_rate, 850, 1e-6, 1e-3)
File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/layers/learning_rate_scheduler.py", line 535, in linear_lr_warmup
tensor.assign(decayed_lr, lr)
File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/layers/control_flow.py", line 1595, in exit
self.block.complete()
File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/layers/control_flow.py", line 1680, in complete
'is_scalar_condition': self.is_scalar_condition
File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/framework.py", line 2479, in append_op
kwargs.get("stop_gradient", False))
File "/opt/conda/envs/python27-paddle120-env/lib/python2.7/site-packages/paddle/fluid/dygraph/tracer.py", line 47, in trace_op
not stop_gradient)
TypeError: trace(): incompatible function arguments. The following argument types are supported:
- (self: paddle.fluid.core_avx.Tracer, arg0: unicode, arg1: Dict[unicode, handle], arg2: Dict[unicode, handle], arg3: Dict[unicode, Variant], arg4: paddle::platform::CUDAPlace, arg5: bool) -> None
- (self: paddle.fluid.core_avx.Tracer, arg0: unicode, arg1: Dict[unicode, handle], arg2: Dict[unicode, handle], arg3: Dict[unicode, Variant], arg4: paddle::platform::CPUPlace, arg5: bool) -> None
Invoked with: <paddle.fluid.dygraph.tracer.Tracer object at 0x7f6cc2abaa70>, 'conditional_block', {'Input': [], 'Cond': [name tmp_2, dtype: VarType.FP32 shape: [1L] lod: {} dim: 1 layout: NCHW dtype: bool data: [1] ]}, {'Scope': [name _generated_var_0, shape: [0L], not inited], 'Out': []}, {'sub_block': idx: 1 parent_idx: 0 , 'is_scalar_condition': True}, <paddle.fluid.core_avx.CUDAPlace object at 0x7f6cc2b0d7d8>, True
部分代码: learning_rate = fluid.layers.piecewise_decay(boundaries=[13600, 20400], values=[1e-3, 1e-4, 1e-5]) decayed_lr = fluid.layers.linear_lr_warmup(learning_rate, 850, 1e-6, 1e-3) opt = fluid.optimizer.Adam(learning_rate=decayed_lr, regularization=fluid.regularizer.L2Decay(regularization_coeff=5e-4))