-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
logger manager #45909
logger manager #45909
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
logger does not belong to Fleet class.
@@ -1335,17 +1329,13 @@ def _minimize_impl(self, | |||
no_grad_set=no_grad_set) | |||
|
|||
if meta_optimizer: | |||
# print("before minimize program id:", id(loss.block.program)) |
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.
logger.debug()?
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.
done
optimize_ops, params_grads = meta_optimizer.minimize( | ||
loss, startup_program, parameter_list, no_grad_set=no_grad_set) | ||
# print("after minimize program id:", id(loss.block.program)) |
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.
Same as before
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.
done
# limitations under the License. | ||
|
||
__all__ = [ #noqa | ||
'get_host_name_ip', |
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.
Are all these codes for the users?
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.
removed
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.
Small comments.
@@ -1463,3 +1479,41 @@ def _minimize_losses_impl(self, | |||
fleet.util._set_strategy(context["valid_strategy"]) | |||
|
|||
return optimize_ops, params_grads | |||
|
|||
def setLogLevel(self, level): |
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.
Move to log_util
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.
done
|
||
__all__ = [] | ||
|
||
from .log_utils import get_logger |
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.
Remove them in the future PR.
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.
LGTM
@@ -90,3 +91,6 @@ | |||
shrink = fleet.shrink | |||
get_hybrid_communicate_group = fleet.get_hybrid_communicate_group | |||
distributed_scaler = distributed_scaler | |||
set_log_level = log_util.set_log_level | |||
get_log_level_code = log_util.get_log_level_code |
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.
get_log_level
one is enough!
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.
keeping
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.
LGTM
* fix apis global scatter/gather * update
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.
LGTM
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.
LGTM
667c094
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.
LGTM
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.
- 如果API是设计为只限内部调用的,建议API的名称有特殊的标识,常见的做法是用
_
开头命名。 - API不公开,不代表API不需要写文档。
import logging | ||
|
||
|
||
def get_logger(log_level, name="root"): |
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.
why we need another 'get_logger'? there are multiple versions of this tiny utility.
$ grep -irn 'def get_logger' python
python/paddle/distributed/utils/log_utils.py:18:def get_logger(log_level, name="root"):
python/paddle/distributed/auto_parallel/utils.py:31:def get_logger(log_level, name="auto_parallel"):
python/paddle/distributed/fleet/utils/http_server.py:30:def get_logger(name, level, fmt):
python/paddle/distributed/fleet/launch_utils.py:267:def get_logger(log_level=20, name="root"):
python/paddle/fluid/tests/unittests/auto_checkpoint_utils.py:44:def get_logger():
python/paddle/fluid/incubate/fleet/utils/http_server.py:25:def get_logger(name, level, fmt):
python/paddle/fluid/log_helper.py:22:def get_logger(name, level, fmt=None):
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.
This should be resolved later.
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
__all__ = [] |
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.
APIs are only hidden from here. But APIs are still accessible by
from paddle.distributed.utils.launch_utils import get_cluster, get_gpus, get_cluster_from_args
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.
Considering to add a prefix '_'.
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.
下划线的意思是模块内部,也就是一个文件内部。
加不加两可之间。我还没有找到这个方面的标准。
但是不能主动暴露给用户。
PR types
Others
PR changes
Others
Describe
distributed/utils
which users don't need.log samples: