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

[ENH] option to turn off printing in prediction/inference #1576

Open
dara1400 opened this issue Jun 4, 2024 · 3 comments
Open

[ENH] option to turn off printing in prediction/inference #1576

dara1400 opened this issue Jun 4, 2024 · 3 comments
Labels
enhancement New feature or request feature request New feature or request

Comments

@dara1400
Copy link

dara1400 commented Jun 4, 2024

I want to use model.predict in a loop.
It keeps printing this:

GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]

Is there way to stop it from printing?

@IlIlllIIllIIlll
Copy link

First, import the logging module:

import logging

Then, add the following line to suppress the message:

logging.getLogger("lightning.pytorch.utilities.rank_zero").setLevel(logging.WARNING)

This will prevent the following output from being printed:

GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs

Next, add this line to suppress another message:

logging.getLogger("lightning.pytorch.accelerators.cuda").setLevel(logging.WARNING)

This will stop the following output from appearing:

LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]

Good luck!

@fkiraly fkiraly changed the title Stop printing in prediction [ENH] Stop printing in prediction Aug 25, 2024
@fkiraly
Copy link
Collaborator

fkiraly commented Aug 25, 2024

Related: sktime/sktime#6891 - should we perhaps address this at the source, and add a verbosity option, @XinyuWuu?

@fkiraly fkiraly added the enhancement New feature or request label Aug 25, 2024
@fkiraly fkiraly changed the title [ENH] Stop printing in prediction [ENH] option to turn off printing in prediction/inference Aug 25, 2024
@fkiraly fkiraly added the feature request New feature or request label Aug 25, 2024
@XinyuWuu
Copy link
Member

Related: sktime/sktime#6891 - should we perhaps address this at the source, and add a verbosity option, @XinyuWuu?

Good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants