diff --git a/unsloth/__init__.py b/unsloth/__init__.py index 068c9651df..74312389c9 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -147,6 +147,8 @@ from .import_fixes import fix_vllm_aimv2_issue fix_vllm_aimv2_issue(); del fix_vllm_aimv2_issue; from .import_fixes import ignore_logger_messages ignore_logger_messages(); del ignore_logger_messages; +from .import_fixes import patch_ipykernel_hf_xet +patch_ipykernel_hf_xet(); del patch_ipykernel_hf_xet; # Torch 2.4 has including_emulation if DEVICE_TYPE == "cuda": diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py index 52de044712..30fd96553c 100644 --- a/unsloth/import_fixes.py +++ b/unsloth/import_fixes.py @@ -135,3 +135,26 @@ def ignore_logger_messages(): except: pass pass + +def patch_ipykernel_hf_xet(): + # HF-XET == 1.1.10 and ipykernel == 7.0.0 causes issues + # See https://github.com/huggingface/xet-core/issues/526 + # 2025-10-13T20:37:33.028737Z ERROR Python exception updating progress:, error: PyErr { type: , value: LookupError(), traceback: Some() }, caller: "src/progress_update.rs:313" + # at /home/runner/work/xet-core/xet-core/error_printer/src/lib.rs:28 + if importlib.util.find_spec("hf_xet") is None: return + if importlib.util.find_spec("ipykernel") is None: return + if importlib.util.find_spec("huggingface_hub") is None: return + if ( + Version(importlib_version("hf_xet")) == Version("1.1.10") + ) and ( + Version(importlib_version("ipykernel")) > Version("6.30.1") + ): + print( + "#### Unsloth: `hf_xet==1.1.10` and `ipykernel>6.30.1` breaks progress bars. Disabling for now in XET.\n"\ + "#### Unsloth: To re-enable progress bars, please downgrade to `ipykernel==6.30.1` or wait for a fix to\n"\ + "https://github.com/huggingface/xet-core/issues/526" + ) + from huggingface_hub.utils import disable_progress_bars + disable_progress_bars() + pass +pass