From 96edc89442ea366127344e22448b3ccf7eaeaba1 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 12 Jun 2026 07:08:10 +0000 Subject: [PATCH] gpu_init: satisfy the import-hoist lint in the compile-thread patch The checker does not count attribute assignment on an aliased module import as a use and flagged _zoo_common as added-but-unused. Set the attribute through importlib.import_module instead; importlib is already a module-level import here. Behaviour unchanged. --- unsloth/_gpu_init.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unsloth/_gpu_init.py b/unsloth/_gpu_init.py index 7869d9e2b5..1ed3d1768f 100644 --- a/unsloth/_gpu_init.py +++ b/unsloth/_gpu_init.py @@ -199,8 +199,10 @@ if os.environ.get("UNSLOTH_FORCE_SINGLE_COMPILE_WORKER", "0") == "1": pass os.environ["TORCHINDUCTOR_COMPILE_THREADS"] = "1" try: - from unsloth_zoo.temporary_patches import common as _zoo_common - _zoo_common.determine_compile_threads = lambda: 1 + setattr( + importlib.import_module("unsloth_zoo.temporary_patches.common"), + "determine_compile_threads", lambda: 1, + ) except Exception: pass