Skip to content

get_config_arg() and make_get_config_arg() in trainer/config_parser.py produces error in demo python script #2173

@juliecbd

Description

@juliecbd

In trainer/config_parser.py file:

def make_get_config_arg(config_args):
def get_config_arg(name, type, default=None):
if type == bool:
s = config_args.get(name)
if not s:
return default
if s == 'True' or s == '1' or s == 'true':
return True
if s == 'False' or s == '0' or s == 'false':
return False
raise ValueError('Value of config_arg %s is not boolean' % name)
else:
return type(config_args.get(name, default))

return get_config_arg

but some demo python files directly call get_config_arg and this produces error.

For example model_zoo/resnet/example/resnet.py

from paddle.trainer_config_helpers import *
"""
paper: https://arxiv.org/abs/1512.03385
"""
is_test = get_config_arg("is_test", bool, False)
is_predict = get_config_arg("is_predict", bool, False)
data_provider = get_config_arg("data_provider", bool, True)
layer_num = get_config_arg("layer_num", int, 50)

Could anyone explain this?

Thank you

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions