Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Suppress only torchao's cosmetic cpp-extensions warning (#6506)

Daniel Hanad2546e5929e
diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py
index ffbc24362fd..5afd6f4b37a 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