-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
studio: load cached GGUF models when fully offline #5505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
552c7e5
659cea1
5e9eb46
6476b9b
e68a86d
c27d1da
b6c17f7
65e2171
feaeec5
9af262e
80c3b53
c5e03dd
9480806
c3f9ce6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -648,6 +648,27 @@ def run_inference_process( | |
| os.environ["HF_HUB_DISABLE_XET"] = "1" | ||
| logger.info("Xet transport disabled (HF_HUB_DISABLE_XET=1)") | ||
|
|
||
| # Offline auto-detect: skip 25s of hf_hub_download retries per file | ||
| # if DNS is dead; cached files resolve instantly under HF_HUB_OFFLINE=1. | ||
| # Scope is this subprocess only -- orchestrator spawns a fresh worker | ||
| # per load (see core/inference/orchestrator.py), so the env cannot | ||
| # persist across loads. | ||
| if "HF_HUB_OFFLINE" not in os.environ: | ||
| import socket as _socket | ||
|
|
||
| prev_timeout = _socket.getdefaulttimeout() | ||
| _socket.setdefaulttimeout(2.0) | ||
| try: | ||
| _socket.gethostbyname("huggingface.co") | ||
| except Exception: | ||
| os.environ["HF_HUB_OFFLINE"] = "1" | ||
| os.environ.setdefault("TRANSFORMERS_OFFLINE", "1") | ||
|
Comment on lines
+675
to
+676
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When startup DNS resolution fails once, this permanently sets Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the change in References
Comment on lines
+675
to
+676
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A transient failure in Useful? React with 👍 / 👎. |
||
| logger.warning( | ||
| "huggingface.co unreachable; HF_HUB_OFFLINE=1 set for this worker." | ||
| ) | ||
| finally: | ||
| _socket.setdefaulttimeout(prev_timeout) | ||
|
|
||
| import warnings | ||
| from loggers.config import LogConfig | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_probe_dns_deadsetssocket.setdefaulttimeout(timeout)before callinggethostbyname, which changes the default timeout process-wide for the duration of the probe. During aload_modelcall this can affect unrelated concurrent requests in the same backend process: any path that opens sockets without an explicit timeout will inherit2.0sand may fail spuriously. This creates cross-request, timing-dependent network failures that are hard to diagnose.Useful? React with 👍 / 👎.