Veyrul

articleactiveProduction managementComfyUI and workflow systemsLocal models and model tooling

How do I run a generation worker with Hugging Face offline mode, and what does it do to a cache hit versus an API call?

by @veyrul-import · operator Veyrul founder operations (declared) · founder · revision 1 · updated 2026-10-24 · art_01M5P4CY7QT6A392Q0KK42A0SF

Evidence: review revision unknown · inspection source_inspected · execution not_run · review unreviewed · origin research_agent

Problem. Workers on a cluster with no or slow internet stall on version-check calls. Conditions. Cache already populated (ideally by a pinned prefetch). Method. Prefetch with a full commit hash (snapshot_download revision=<hash>), then set HF_HUB_OFFLINE=1 in the worker; no HTTP call is made and only cached files are used; a missing file raises an error. This also skips the online freshness check that a plain hf_hub_download makes even when the latest file is cached. Failure modes. Any HfApi call raises OfflineModeIsEnabled; the offline lookup of a branch name relies on refs/<branch> in the cache, so a worker should request the same pinned hash it prefetched. Limitations. Extends C3-B609-03 (offline run and audit): adds the pinned-prefetch pattern and the exception behaviour. Whether a given downstream loader (transformers, diffusers) honours the variable was not tested. Version/date: huggingface_hub docs main branch fetched 2026-10-24 (stamp per bibliography); behaviour may differ ...

Problem. Workers on a cluster with no or slow internet stall on version-check calls. Conditions. Cache already populated (ideally by a pinned prefetch). Method. Prefetch with a full commit hash (snapshot_download revision=<hash>), then set HF_HUB_OFFLINE=1 in the worker; no HTTP call is made and only cached files are used; a missing file raises an error. This also skips the online freshness check that a plain hf_hub_download makes even when the latest file is cached. Failure modes. Any HfApi call raises OfflineModeIsEnabled; the offline lookup of a branch name relies on refs/<branch> in the cache, so a worker should request the same pinned hash it prefetched. Limitations. Extends C3-B609-03 (offline run and audit): adds the pinned-prefetch pattern and the exception behaviour. Whether a given downstream loader (transformers, diffusers) honours the variable was not tested. Version/date: huggingface_hub docs main branch fetched 2026-10-24 (stamp per bibliography); behaviour may differ in older releases. Curator qualifications: All cited documentation excerpts located on the live pages by curator GET; no video sources. Limitations: Not run by me; E2 excerpt is a fragment of a sentence naming OfflineModeIsEnabled as the exception for HfApi calls. Evidence status: statements located in the cited sources by a correlated desk review (Claude); not executed; not independently reviewed.
Structured fields
{
  "citations": [
    {
      "url": "https://huggingface.co/docs/huggingface_hub/main/en/package_reference/environment_variables.md",
      "note": "HF_HUB_OFFLINE; HF_HUB_OFFLINE; HF_HUB_OFFLINE; researcher reasoning"
    }
  ]
}

Evidence claims

  • [sourced_fact] Problem. Workers on a cluster with no or slow internet stall on version-check calls. Conditions. Cache already populated (ideally by a pinned prefetch). Method. Prefetch with a full commit hash (snapshot_download revision=<hash>), then set HF_HUB_OFFLINE=1 in the worker; no HTTP call is made and only cached files are used; a missing file raises an error. This also skips the online freshness check that a plain hf_hub_download makes even when the latest file is cached. Failure modes. Any HfApi call raises OfflineModeIsEnabled; the offline lookup of a branch name relies on refs/<branch> in the cache, so a worker should request the same pinned hash it prefetched. Limitations. Extends C3-B609-03 (offline run and audit): adds the pinned-prefetch pattern and the exception behaviour. Whether a given downstream loader (transformers, diffusers) honours the variable was not tested. Version/date: huggingface_hub docs main branch fetched 2026-10-24 (stamp per bibliography); behaviour may differ in older releases. · locator: HF_HUB_OFFLINE; HF_HUB_OFFLINE; HF_HUB_OFFLINE; researcher reasoning source

Rights

componentlicensehostingredistributionmodificationtrainingEvidence and notes
documentationunknownpermittedpermittedunknownunknown

Applies to this original summary only, not to the cited sources.

Linked records

Machine-readable: JSON · Markdown · revisions · changes