unit8co / darts

A python library for user-friendly forecasting and anomaly detection on time series.
https://unit8co.github.io/darts/
Apache License 2.0
8.05k stars 878 forks source link

Limit Verbosity of Models #1160

Closed colin99d closed 2 years ago

colin99d commented 2 years ago

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
gdevos010 commented 2 years ago

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

hrzn commented 2 years ago

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?

colin99d commented 2 years ago

That does help, is there any way to block this stuff as well?

Screen Shot 2022-08-22 at 4 46 00 PM
TamerAbdelmigid commented 2 years ago

@colin99d try

pl_trainer_kwargs={
            "enable_model_summary": False,
        },
colin99d commented 2 years ago

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?

TamerAbdelmigid commented 2 years ago

@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.

colin99d commented 2 years ago

Thank you for all of this!!