fix: patch is_offline_mode removed in huggingface_hub ≥ 0.21#56
Open
Manuscrit wants to merge 1 commit intolongtermrisk:v0.9from
Open
fix: patch is_offline_mode removed in huggingface_hub ≥ 0.21#56Manuscrit wants to merge 1 commit intolongtermrisk:v0.9from
Manuscrit wants to merge 1 commit intolongtermrisk:v0.9from
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
huggingface_hub>= 0.21 removed theis_offline_modefunctiontransformersandpeftstill dofrom huggingface_hub import is_offline_mode, causing anImportErrorwhen the inference CLI starts on nodes with a newerhuggingface_hubinstalledopenweights/jobs/inference/cli.py, before any dependent library is importedTruewhenHF_HUB_OFFLINEis set in the environment,FalseotherwiseTest plan
huggingface_hub>= 0.21 installedhuggingface_hub(thehasattrguard makes the patch a no-op)