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

[Dy2Stat-log] Add feature also_to_stdout and optimize log messages #27285

Merged
merged 10 commits into from
Sep 17, 2020

Conversation

liym27
Copy link
Contributor

@liym27 liym27 commented Sep 14, 2020

PR types

Others

PR changes

Others

Describe

1. New features: also output log or code to sys.stdout

  • Add parameter also_to_stdout for API paddle.jit.set_verbosity to control whether to also output log messages to sys.stdout.
  • Add parameter also_to_stdout for API paddle.jit.set_code_level to control whether to also output code to sys.stdout.

2. Optimize log messages in dygraph-to-static

  • Add logger_name Dynamic-to-Static in logger format so that logs about Dynamic-to-Static can be distinguished from other logs
    • Before:
    2020-09-15 11:13:18,909 WARNING: warn message ...
    
    After:
    2020-09-15 11:13:18,909 Dynamic-to-Static WARNING: warn message ...
    
  • Optimization on other details

3. In dygraph-to-static, use log function from logging_utils to make the log more standardized

Use logging_utils.warn to replace other warn function like logging.warning, _logger.warning and warnings.warn in dygraph_to_static


优化 log 展示效果,方便区分动转静和框架其他log

1. 新特性:也可以输出 log 或 code 到 sys.stdout

  • API paddle.jit.set_verbosity 增加参数 also_to_stdout 控制是否也将日志信息输出到 sys.stdout
  • API paddle.jit.set_code_level 增加参数 also_to_stdout 控制是否也将code信息输出到 sys.stdout

2. 优化动转静中的 log 信息

  • log 格式中,增加 logger 名称 Dynamic-to-Static,使得动转静 log 与框架其他 log 区分开
    • Before:
    2020-09-15 11:13:18,909 WARNING: warn message ...
    
    After:
    2020-09-15 11:13:18,909 Dynamic-to-Static WARNING: warn message ...
    
  • 优化了 log 信息的一些其他细节

3. 动转静的 log/warning等 统一使用 logging_utils 中的接口,以规范化动转静 log (动转静log 会统一 Dynamic-to-Static 标识,统一控制是否输出到 stdout)

本PR修改:使用logging_utils.warn 替代了动转静相关文件中的 warn 函数 如 logging.warning, _logger.warningwarnings.warn


文档预览图

set_code_level

image

image

set_verbosity

image

image

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot-old
Copy link

paddle-bot-old bot commented Sep 14, 2020

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@liym27 liym27 force-pushed the optimize_log branch 2 times, most recently from 121d3b0 to 6fea372 Compare September 15, 2020 03:39
@liym27 liym27 changed the title Optimize log [Dy2Stat-log] Add feature also_to_stdout and optimize log messages Sep 15, 2020
@liym27 liym27 requested review from zhhsplendid, chenwhql and Aurelius84 and removed request for zhhsplendid and chenwhql September 15, 2020 08:39
chenwhql
chenwhql previously approved these changes Sep 15, 2020
Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

LGTM

zhhsplendid
zhhsplendid previously approved these changes Sep 16, 2020
Copy link
Member

@zhhsplendid zhhsplendid left a comment

Choose a reason for hiding this comment

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

LGTM

TCChenlong
TCChenlong previously approved these changes Sep 17, 2020
Copy link
Contributor

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

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

LGTM

Change-Id: Ic336435937f9bc2dc9bf89fc5591d737d1b76936
Change-Id: Id128d122c632d5e06064d831ded4a381959f2ad7
Change-Id: I5aaff665d4ccf7125cc5600b1cc223c0c1b4a4b1
Change-Id: If51c3c7606cab191bd971faa22cc21da7af651ea
Change-Id: I6b7bf6f56447dd825a15bb077194e11d03f76476
Change-Id: I4d489342fa7220e2e806d06d942c36d1ab49d1eb
Change-Id: I79050c2a8436d44cd5cf22f41aad0be1036a1cda
Change-Id: I52ddd1f3518a8ebbbc082bb2d4896da554b89a79
Change-Id: I5acea6b0ae25b9c1c405b979ab24d6e8ae7c3ba2
TCChenlong
TCChenlong previously approved these changes Sep 17, 2020
Copy link
Contributor

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

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

LGTM

Change-Id: Ie8bdee4c5a35dc6f5f508329d2716108c88f56c3
Copy link
Contributor

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@zhhsplendid zhhsplendid left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

LGTM

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

5 participants