mirror of
https://github.com/brycedrennan/imaginAIry
synced 2024-10-31 03:20:40 +00:00
c7a822d701
- --init-image accepts urls - cleanup command line code
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
import logging.config
|
|
import warnings
|
|
|
|
from pytorch_lightning import _logger as pytorch_logger
|
|
from transformers.modeling_utils import logger as modeling_logger
|
|
from transformers.utils.logging import _configure_library_root_logger
|
|
|
|
|
|
def disable_transformers_custom_logging():
|
|
_configure_library_root_logger()
|
|
logger = modeling_logger.parent
|
|
logger.handlers = []
|
|
logger.propagate = True
|
|
logger.setLevel(logging.NOTSET)
|
|
|
|
|
|
def disable_pytorch_lighting_custom_logging():
|
|
pytorch_logger.setLevel(logging.NOTSET)
|
|
|
|
|
|
def disable_common_warnings():
|
|
warnings.filterwarnings(
|
|
"ignore",
|
|
category=UserWarning,
|
|
message=r"The operator .*?is not currently supported.*",
|
|
)
|
|
warnings.filterwarnings(
|
|
"ignore", category=UserWarning, message=r"The parameter 'pretrained' is.*"
|
|
)
|
|
warnings.filterwarnings(
|
|
"ignore", category=UserWarning, message=r"Arguments other than a weight.*"
|
|
)
|
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
|
|
|
|
def suppress_annoying_logs_and_warnings():
|
|
disable_transformers_custom_logging()
|
|
disable_pytorch_lighting_custom_logging()
|
|
disable_common_warnings()
|