diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py index ffbc24362f..5afd6f4b37 100644 --- a/unsloth/import_fixes.py +++ b/unsloth/import_fixes.py @@ -152,10 +152,12 @@ if not UNSLOTH_ENABLE_LOGGING: sys.stderr.add_filter("CUTE_INVALID_CONTROL_PATH") # CUTLASS TMA-related errors when not targeting correct architecture sys.stderr.add_filter("Trying to use tma without CUTE_ARCH_TMA") - # Skipping import of cpp extensions due to incompatible torch version 2.9.0+cu128 for torchao version 0.15.0 - logging.getLogger("torchao").setLevel(logging.ERROR) - # Also filter torchao print to stderr about cpp extensions - sys.stderr.add_filter("Skipping import of cpp extensions") + # torchao logs a cosmetic "Skipping import of cpp extensions" WARNING on torch < 2.11. The + # bnb-4bit / Unsloth paths don't use torchao's cpp kernels, so drop only that record rather + # than raising the whole torchao logger to ERROR. + logging.getLogger("torchao").addFilter( + HideLoggingMessage("Skipping import of cpp extensions due to incompatible torch version") + ) # SyntaxWarning: invalid escape sequence '\.' warnings.filterwarnings("ignore", message = "invalid escape sequence", category = SyntaxWarning) # PYTORCH_CUDA_ALLOC_CONF is deprecated warning from torch