Skip to content

fix: patch is_offline_mode removed in huggingface_hub ≥ 0.21#56

Open
Manuscrit wants to merge 1 commit intolongtermrisk:v0.9from
slacki-ai:fix/is-offline-mode-compat-clean
Open

fix: patch is_offline_mode removed in huggingface_hub ≥ 0.21#56
Manuscrit wants to merge 1 commit intolongtermrisk:v0.9from
slacki-ai:fix/is-offline-mode-compat-clean

Conversation

@Manuscrit
Copy link
Copy Markdown
Collaborator

Summary

  • huggingface_hub >= 0.21 removed the is_offline_mode function
  • Older versions of transformers and peft still do from huggingface_hub import is_offline_mode, causing an ImportError when the inference CLI starts on nodes with a newer huggingface_hub installed
  • Add a one-time compatibility shim at the top of openweights/jobs/inference/cli.py, before any dependent library is imported
  • The shim replicates the original semantics: returns True when HF_HUB_OFFLINE is set in the environment, False otherwise

Test plan

  • Confirm inference jobs succeed on nodes with huggingface_hub >= 0.21 installed
  • Confirm no regression on nodes with older huggingface_hub (the hasattr guard makes the patch a no-op)

Older versions of transformers and peft still import `is_offline_mode`
from huggingface_hub, which was removed in ≥ 0.21, causing an
ImportError when the inference cli starts on nodes with newer
huggingface_hub installed.

Patch the function back in before any dependent library is loaded.
The shim replicates the original semantics: returns True when
HF_HUB_OFFLINE is set in the environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants