Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tool for supervise python api #11562

Closed

Conversation

guochaorong
Copy link
Contributor

resolve #11556

Copy link
Contributor

@panyx0718 panyx0718 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG. Do you have an example output?

module_str = '.'.join(file_name.split('/')[3:])
module_str = '.'.join(module_str.split('.')[:-1])
print module_str
args = parse_args()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we only need to parse_args once at the beginning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes , it will be clearer


def check_api(module_str, dest_dir):
'''get current api's info,
then compare with info loaded from saved'''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can put ``` at the next line.
Would be good to use the same code style as paddle-core's code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it!

@guochaorong
Copy link
Contributor Author

output are as below:
{
"ParallelExecutor.init": {
"keywords": "kwargs",
"args": ["self", "use_cuda", "loss_name", "main_program", "share_vars_from", "exec_strategy", "build_strategy", "num_trainers", "trainer_id"],
"defaults": "(None, None, None, None, None, 1, 0)",
"varargs": null
},
"ParallelExecutor.bcast_params": {
"keywords": null,
"args": ["self"],
"defaults": "None",
"varargs": null
},
"ParallelExecutor.run": {
"keywords": null,
"args": ["self", "fetch_list", "feed", "feed_dict"],
"defaults": "(None, None)",
"varargs": null
}
}

if api changed, error are as below:
Exception: api changed: ParallelExecutor.init

before: {
u 'keywords': u 'kwargs',
u 'args': [u 'self', u 'use_cu**', u 'loss_name', u 'main_program', u 'share_vars_from', u 'exec_strategy', u 'build_strategy', u 'num_trainers', u 'trainer_id'],
u 'defaults': u '(None, None, None, None, None, 1, 0)',
u 'varargs': None
}
now: {
'keywords': 'kwargs',
'args': ['self', 'use_cuda', 'loss_name', 'main_program', 'share_vars_from', 'exec_strategy', 'build_strategy', 'num_trainers', 'trainer_id'],
'defaults': '(None, None, None, None, None, 1, 0)',
'varargs': None
}

@guochaorong
Copy link
Contributor Author

oh, 想起来,于洋老师改了一版优雅版的交了~
https://github.com/PaddlePaddle/Paddle/pull/11573/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants