Update import_fixes.py

This commit is contained in:
Daniel Han 2025-10-14 05:40:21 -07:00
commit f473b69635
2 changed files with 25 additions and 0 deletions

View file

@ -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":

View file

@ -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: <class 'LookupError'>, value: LookupError(<ContextVar name='shell_parent' at 0x7535b4cebd80>), traceback: Some(<traceback object at 0x753408489f40>) }, 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