-
Notifications
You must be signed in to change notification settings - Fork 3.5k
How to disable printings about GPU/TPU #3431
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
Comments
Hi! thanks for your contribution!, great first issue! |
It is currently not possible to disable printing of that. For reference it is printed by these lines: |
Check #2757. |
@rohitgr7 These two lines helped me
|
This is still an issue today, especially when working with multiple GPUs and num_of_workers>0... |
This is still an issue. This actually can be fixed easily hope someone can do this. |
Another way to disable these messages:
|
It seems that the base logger for lightning has changed since @7rick03ligh7's last comment. The following does the job now logging.getLogger("pytorch_lightning").setLevel(logging.WARNING) |
As of lightning v1.9.4,
|
Let's remove all warnings, and let's use some meaningless value 0. |
as of PL 2.2.4: logger = logging.getLogger('pytorch_lightning.utilities.rank_zero')
logger.setLevel(logging.ERROR)
... your code here ...
logger.setLevel(logging.INFO) or logger = logging.getLogger('pytorch_lightning.utilities.rank_zero')
class IgnorePLFilter(logging.Filter):
def filter(self, record):
return 'available:' not in record.getMessage()
logger.addFilter(IgnorePLFilter()) |
Customize the keywords according to your needs. import logging
class IgnorePLFilter(logging.Filter):
def filter(self, record):
keywords = ['available:', 'CUDA', 'LOCAL_RANK:']
return not any(keyword in record.getMessage() for keyword in keywords)
logging.getLogger('pytorch_lightning.utilities.rank_zero').addFilter(IgnorePLFilter())
logging.getLogger('pytorch_lightning.accelerators.cuda').addFilter(IgnorePLFilter()) |
With lightning def device_info_filter(record):
return "PU available: " not in record.getMessage()
logging.getLogger("lightning.pytorch.utilities.rank_zero").addFilter(device_info_filter) modified from #13378 (comment) |
How to disable this printings?
The text was updated successfully, but these errors were encountered: