-
Notifications
You must be signed in to change notification settings - Fork 42
【Hackathon 9th Sprint No.86】feat: implement AgentUnittestGenerator for both paddle/torch run_model.py #422
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
base: develop
Are you sure you want to change the base?
Conversation
|
Thanks for your contribution! |
|
收到您的PR,感谢您的贡献。 |
|
整体还是很清晰的,PR说明很详细(赞),有几个小改进点:
|
graph_net/paddle/run_model.py
Outdated
| import unittest | ||
| import paddle | ||
| from graph_net.paddle import utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是不可以的。单测脚本应该能脱离graph_net单独工作。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经按照建议进行修改,最新的提交中,生成的单侧脚本不再依赖graph_net
| encode_cfg() { | ||
| MODEL_PATH="$1" python - <<'PY' | ||
| import base64, json, os | ||
| cfg = { | ||
| "decorator_class_name": "AgentUnittestGenerator", | ||
| "decorator_config": { | ||
| "model_path": os.environ["MODEL_PATH"], | ||
| "force_device": "auto", | ||
| "output_path": None, | ||
| "use_dummy_inputs": False, | ||
| }, | ||
| } | ||
| print(base64.b64encode(json.dumps(cfg).encode()).decode()) | ||
| PY | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经按照建议进行修改了
… AgentUnittestGenerator, adopt jinja2 as render engine
Summary
AgentUnittestGeneratorto both run_model entrypoints (run_model.py, run_model.py) to generate standalone unittest scripts frommodel.py+ meta files.jinja2.Templatefor codegen templating (placeholders: target device and dummy/numpy flags);<sample>_test.pybeside each sample.How to Use
python -m graph_net.torch.run_model --model-path /abs/path/to/sample --decorator-config <base64>python -m graph_net.paddle.run_model --model-path /abs/path/to/sample --decorator-config <base64>python <sample_name>_test.py.Validation (manual)
Notes
_get_decoratorstill accepts both argparse.Namespace and dict configs.Sample Artifact
resnet18_test.py
albert-base-v2_test.py