darts icon indicating copy to clipboard operation
darts copied to clipboard

Limit Verbosity of Models

Open colin99d opened this issue 2 years ago • 7 comments

Is your feature request related to a current problem? Please describe. When running models in Jupyterlab there is a lot of output. This limits our ability to make clean dashboards.

Describe proposed solution Add a verbosity argument so that messages can be hidden.

Additional context Below is an example of a dashboard being crowded out by information Screen Shot 2022-08-19 at 4 08 31 PM

colin99d avatar Aug 19 '22 20:08 colin99d

Some print out can be removed by disabling the enable_progress_bar in the pl_trainer_kwargs. I'm not sure which parts you are trying to remove but most of the printouts you see there come from PyTorch Lightning.

 model(
          pl_trainer_kwargs={
              "accelerator": "gpu",
              "enable_progress_bar": False,
          },

Other print outs can be limited as described in issue #927

gdevos010 avatar Aug 21 '22 00:08 gdevos010

Some print out can be removed by disabling the enable_progress_bar in the pl_trainer_kwargs. I'm not sure which parts you are trying to remove but most of the printouts you see there come from PyTorch Lightning.

 model(
          pl_trainer_kwargs={
              "accelerator": "gpu",
              "enable_progress_bar": False,
          },

Other print outs can be limited as described in issue #927

@colin99d could you give a try to these solutions and let us know if that works for you?

hrzn avatar Aug 22 '22 14:08 hrzn

That does help, is there any way to block this stuff as well? Screen Shot 2022-08-22 at 4 46 00 PM

colin99d avatar Aug 22 '22 20:08 colin99d

@colin99d try

pl_trainer_kwargs={
            "enable_model_summary": False,
        },

TamerAbdelmigid avatar Aug 27 '22 19:08 TamerAbdelmigid

I should have follow up. I currently have this: "logger": False, # "enable_progress_bar": False, "enable_model_summary": False, Screen Shot 2022-08-27 at 3 11 41 PM

And im still getting a lot of output. However, this looks like its more of a pytorch-lightning issue. Should I go ahead and close this issue?

colin99d avatar Aug 27 '22 19:08 colin99d

@colin99d I'm currently using this:

warnings.filterwarnings("ignore")
logging.basicConfig(level=logging.CRITICAL)
logging.getLogger("darts.models").setLevel(logging.CRITICAL)
logging.getLogger("pytorch_lightning").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.pl_forecasting_module").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.tcn_model").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.nbeats").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.NHiTSModel").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.nhits").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.torch_forecasting_model").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.forecasting_model").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.baselines").setLevel(logging.CRITICAL)
logging.getLogger("pytorch_lightning.accelerators.gpu").setLevel(logging.CRITICAL)
logging.getLogger("darts.timeseries").setLevel(logging.CRITICAL)
logging.getLogger("darts.utils.utils").setLevel(logging.CRITICAL)
logging.getLogger("darts.utils.torch").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.tft_model").setLevel(logging.CRITICAL)
logging.getLogger("darts.models.forecasting.tft_submodels").setLevel(logging.CRITICAL)
logging.getLogger("darts.utils.data.training_dataset").setLevel(logging.CRITICAL)
logging.getLogger("darts.utils.data.horizon_based_dataset").setLevel(logging.CRITICAL)
logging.getLogger("darts.utils.statistics").setLevel(logging.CRITICAL)
logging.getLogger("darts.dataprocessing.transformers.scaler").setLevel(logging.CRITICAL)
logging.getLogger("darts.dataprocessing.transformers.fittable_data_transformer").setLevel(logging.CRITICAL)

alongside that:

pl_trainer_kwargs={
            "enable_model_summary": False,
            "enable_progress_bar": False,
        },

If you use various models, try add all of them in logging.getLogger("darts.models.forecasting.XXXXXXXX").setLevel(logging.CRITICAL)

another trick is to use:

import IPython
import IPython.display
......
Model.historical_forecasts()
IPython.display.clear_output()

Hope this helps.

TamerAbdelmigid avatar Aug 27 '22 19:08 TamerAbdelmigid

Thank you for all of this!!

colin99d avatar Aug 27 '22 19:08 colin99d