paddelhub迁移学习ImageClassi
有昵称a 发布于2020-03 浏览:1276 回复:4
0
收藏
# Setup runing config for PaddleHub Finetune API
config = hub.RunConfig(

    use_cuda=True,
    num_epoch=1,
    batch_size=16,
    checkpoint_dir='',
    strategy=hub.finetune.strategy.DefaultFinetuneStrategy())
task=hub.ImageClassifierTask(
    feature=feature_map,
    num_classes=5,
    feed_list=feed_list,
    data_reader=data_reader,
    config=config,
    metrics_choices ='f1'
    )

报错

---------------------------------------------------------------------------EnforceNotMet Traceback (most recent call last) in
6 data_reader=data_reader,
7 config=config,
----> 8 metrics_choices ='f1'
9 )
/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)
231 if startup_program is None:
232 self._base_startup_program = clone_program(
--> 233 fluid.default_startup_program(), for_test=False)
234 else:
235 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)
52 var_info = {
53 'name': var.name,
---> 54 'dtype': convert_dtype_to_string(var.dtype),
55 'lod_level': var.lod_level,
56 'shape': var.shape,
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py in dtype(self)
1383 pass
1384 else:
-> 1385 return self.desc.dtype()
1386
1387 @property
EnforceNotMet:

--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
0 std::string paddle::platform::GetTraceBackString(std::string&&, char const*, int)
1 paddle::framework::VarDesc::tensor_desc() const
2 paddle::framework::VarDesc::GetDataType() const

----------------------
Error Message Summary:
----------------------
Error: Getting 'tensor_desc' is not supported by the type of var create_py_reader_0. at (/paddle/paddle/fluid/framework/var_desc.cc:209)

 

 

 

 

 

 

 

 

收藏
点赞
0
个赞
共4条回复 最后由用户已被禁言回复于2022-04
#5Florine_1993回复于2020-04

我也碰到了这样的问题

直接重新加载环境就可以了

0
#4通俗茹茹回复于2020-04

请问你解决了吗?

0
#3西窗无香回复于2020-04

请问你解决了吗

0
#2木二又贝回复于2020-04

请问你解决了吗

 

0
TOP
切换版块