paddlehub多标签分类报错
Created by: good18
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
- 版本、环境信息 1)PaddleHub和PaddlePaddle版本:请提供您的PaddleHub和PaddlePaddle版本号,例如PaddleHub1.4.1,PaddlePaddle1.6.2 2)系统环境:请您描述系统类型,例如Linux/Windows/MacOS/,python版本
- 复现信息:如为报错,请给出复现环境、复现步骤
paddlehub多标签分类在aistudio上运行报错:
源码地址:https://github.com/PaddlePaddle/PaddleHub/tree/release/v1.1.0/demo/multi-label-classification
运行到这一段:
cls_task = hub.MultiLabelClassifierTask( data_reader=reader, feature=pooled_output, feed_list=feed_list, num_classes=dataset.num_labels, config=config)
报错信息: t) in 15 feed_list=feed_list, 16 num_classes=dataset.num_labels, ---> 17 config=config) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/task/classifier_task.py in init(self, feature, num_classes, feed_list, data_reader, startup_program, config, hidden_units, metrics_choices) 229 config=config, 230 hidden_units=hidden_units, --> 231 metrics_choices=metrics_choices) 232 self.class_name = list(data_reader.label_map.keys()) 233 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/task/classifier_task.py in init(self, feature, num_classes, feed_list, data_reader, startup_program, config, hidden_units, metrics_choices) 47 startup_program=startup_program, 48 config=config, ---> 49 metrics_choices=metrics_choices) 50 51 self.feature = feature /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/task/base_task.py in init(self, feed_list, data_reader, main_program, startup_program, config, metrics_choices) 296 else: 297 self._base_main_program = clone_program( --> 298 main_program, for_test=False) 299 if startup_program is None: 300 self._base_startup_program = clone_program( /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/common/paddle_helper.py in clone_program(origin_program, for_test) 272 dest_program = fluid.Program() 273 _copy_vars_and_ops_in_blocks(origin_program.global_block(), --> 274 dest_program.global_block()) 275 dest_program = dest_program.clone(for_test=for_test) 276 if not for_test: /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/common/paddle_helper.py in _copy_vars_and_ops_in_blocks(from_block, to_block) 145 for var in from_block.vars: 146 var = from_block.var(var) --> 147 var_info = copy.deepcopy(get_variable_info(var)) 148 if isinstance(var, fluid.framework.Parameter): 149 to_block.create_parameter(**var_info) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/common/paddle_helper.py in get_variable_info(var) 63 var_info['optimize_attr'] = var.optimize_attr 64 var_info['regularizer'] = var.regularizer ---> 65 var_info['gradient_clip_attr'] = var.gradient_clip_attr 66 var_info['do_model_average'] = var.do_model_average 67 else: AttributeError: 'Parameter' object has no attribute 'gradient_clip_attr'