From 101de1927a60c2a40446ffb47648b092a8a64005 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 26 Jun 2026 19:45:32 -0700 Subject: [PATCH] Silence torchao _C*.so load-failure WARNING on torch >= 2.11 (#6712) On torch >= 2.11 torchao tries to dlopen each prebuilt _C*.so and logs a per-file "Failed to load .../_C*.so" WARNING via the torchao logger when one cannot load. This happens on an ABI tag mismatch in the prebuilt wheel (for example a cp310 .so under a cp312 runtime, as on Colab) or when the kernel targets an arch the GPU does not have (mxfp8 needs FP8 hardware, _C_cutlass_90a is Hopper/SM90 only). torchao falls back to its non-cpp paths and Unsloth's bnb-4bit / Triton kernels do not use these, so the warning is cosmetic. Add a HideLoggingMessage filter on the same torchao logger that already filters the torch < 2.11 "Skipping import of cpp extensions" message, so only these records are dropped rather than raising the whole logger to ERROR. --- unsloth/import_fixes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py index 5afd6f4b37..bff55b4e7b 100644 --- a/unsloth/import_fixes.py +++ b/unsloth/import_fixes.py @@ -158,6 +158,11 @@ if not UNSLOTH_ENABLE_LOGGING: logging.getLogger("torchao").addFilter( HideLoggingMessage("Skipping import of cpp extensions due to incompatible torch version") ) + # torch >= 2.11 path: torchao dlopens each prebuilt _C*.so and logs "Failed to load + # .../_C*.so" when one can't (ABI tag mismatch in the wheel, e.g. a cp310 .so under a + # cp312 runtime on Colab, or an arch-specific kernel the GPU lacks). It falls back to + # non-cpp paths and Unsloth doesn't use these kernels, so drop the cosmetic record. + logging.getLogger("torchao").addFilter(HideLoggingMessage("Failed to load ")) # SyntaxWarning: invalid escape sequence '\.' warnings.filterwarnings("ignore", message = "invalid escape sequence", category = SyntaxWarning) # PYTORCH_CUDA_ALLOC_CONF is deprecated warning from torch