fix_huggingface_hub

This commit is contained in:
Daniel Han 2026-01-02 00:14:44 -08:00
commit 8d44bd35d3
2 changed files with 10 additions and 0 deletions

View file

@ -30,16 +30,19 @@ from .import_fixes import (
check_fbgemm_gpu_version,
torchvision_compatibility_check,
fix_diffusers_warnings,
fix_huggingface_hub,
)
fix_message_factory_issue()
check_fbgemm_gpu_version()
torchvision_compatibility_check()
fix_diffusers_warnings()
fix_huggingface_hub()
del fix_message_factory_issue
del check_fbgemm_gpu_version
del torchvision_compatibility_check
del fix_diffusers_warnings
del fix_huggingface_hub
# This check is critical because Unsloth optimizes these libraries by modifying
# their code at import time. If they're imported first, the original (slower,

View file

@ -539,3 +539,10 @@ def fix_executorch():
def fix_diffusers_warnings():
# Silence Flax classes are deprecated and will be removed in Diffusers v1.0.0.
os.environ["DIFFUSERS_VERBOSITY"] = "error"
def fix_huggingface_hub():
# huggingface_hub.is_offline_mode got removed, so add it back
import huggingface_hub
if not hasattr(huggingface_hub, "is_offline_mode"):
huggingface_hub.is_offline_mode = lambda: huggingface_hub.constants.HF_HUB_OFFLINE