diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py index cc4f6dbfc7..b31b47e69b 100644 --- a/unsloth/import_fixes.py +++ b/unsloth/import_fixes.py @@ -17,8 +17,16 @@ import importlib.util from pathlib import Path from importlib.metadata import version as importlib_version from packaging.version import Version +import logging UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1" +# Ignore logging messages +class HideLoggingMessage(logging.Filter): + __slots__ = "text", + def __init__(self, text): self.text = text + def filter(self, x): return not (self.text in x.getMessage()) +pass + # Fix up AttributeError: 'MessageFactory' object has no attribute 'GetPrototype' # MUST do this at the start primarily due to tensorflow causing issues def fix_message_factory_issue():