-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create RFC for a logging system and list some required features
- Loading branch information
1 parent
b379b19
commit 9442b54
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# PyTorch Logging System | ||
|
||
## **Summary** | ||
Create a new message logging system for PyTorch with the following requirements: | ||
|
||
* All errors, warnings, and other messages generated by PyTorch should do so | ||
using the the logging system API | ||
|
||
* The APIs for emitting messages and changing settings should all be consistent | ||
between C++ and Python | ||
|
||
* Offer different log levels (info, warning, error, ...) | ||
|
||
* Offer different classes of messages | ||
|
||
- TODO: What are some of the message classes that we'll need? | ||
|
||
* Creating new message classes and log levels should be easy | ||
|
||
* Settings to turn warnings for a specific message class into errors | ||
|
||
* Settings to disable specific message classes and log levels | ||
|
||
- TODO: However, I assume most errors should not be disableable | ||
|
||
* Settings to avoid emitting duplicate messages generated by multiple | ||
`torch.distribted` ranks (related to issue | ||
[#68768](https://github.com/pytorch/pytorch/issues/68768)) | ||
|
||
* Ability to make a particular warning class or log level only warn once | ||
|
||
- NOTE: Currently `TORCH_WARN_ONCE` does this in C++, but there is no Python | ||
equivalent | ||
|
||
- TODO: Should there be a setting to turn a warn-always into a warn-once for | ||
a given message class? | ||
|
||
* Settings can be changed from Python, C++, or environment variables | ||
|
||
* Should integrate with Meta's internal logging system, which is | ||
[glog](https://github.com/google/glog) | ||
|
||
- TODO: What are all the requirements that definine "integrating with glog" | ||
|
||
* Must be OSS-friendly, so it shouldn't require libraries (like glog) which may | ||
cause incompatibility issues for projects that use PyTorch | ||
|
||
|
||
## **Motivation** | ||
Original issue: [link](https://github.com/pytorch/pytorch/issues/72948) | ||
|
||
Currently, it is challenging for PyTorch developers to provide messages that | ||
act consistently between Python and C++. | ||
|
||
It is also challenging for PyTorch users to manage the messages that PyTorch | ||
emits. For instance, if a PyTorch user happens to be calling PyTorch functions | ||
that emit lots of warnings, it can be difficult for them to filter out those | ||
warnings so that their project's users don't get bombarded with warnings that | ||
they don't need to see. |