Skip to content

Conversation

@Pfannkuchensack
Copy link
Collaborator

Summary

Add local_files_only=True to all model loader from_pretrained() calls to prevent network requests during model loading.

When loading models, HuggingFace's from_pretrained() attempts to connect to the internet for validation or updates. This causes generation to hang or fail when the network is unavailable, slow, or behind a proxy.

Affected loaders:

  • stable_diffusion.py - SD1, SD2, SDXL, SDXLRefiner, SD3
  • generic_diffusers.py - T2IAdapter and generic models
  • flux.py - CLIP and T5 Tokenizer/Encoder
  • cogview4.py - CogView4 models
  • onnx.py - ONNX models

Related Issues / Discussions

User report: #8630

QA Instructions

  1. Disconnect from internet or block HuggingFace domains
  2. Load any SDXL, SD1.5, Flux, or CogView4 model
  3. Verify model loads successfully without network timeout errors

Merge Plan

Standard merge - no special handling required.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

…ests

When loading models, HuggingFace's from_pretrained() would attempt to
connect to the internet for validation or updates, causing generation
to hang when network is unavailable or slow.

Added local_files_only=True to all model loaders:
- stable_diffusion.py (SD1, SD2, SDXL, SDXLRefiner, SD3)
- generic_diffusers.py (T2IAdapter)
- flux.py (CLIP, T5 Tokenizer/Encoder)
- cogview4.py
- onnx.py
@github-actions github-actions bot added python PRs that change python files backend PRs that change backend files labels Jan 3, 2026
@lstein
Copy link
Collaborator

lstein commented Jan 3, 2026

Good to get all these fixes in. I will test tomorrow. Might or might not get into RC2.

@lstein lstein marked this pull request as ready for review January 4, 2026 00:57
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested with examples from SD1, SD2, SD3, SDXL, Cogview, Flux and Z-Image, and all models loaded and ran with the internet disconnected.

Question: There are several loaders which call class.from_single_file() to load checkpoint-style models. This also takes a local_files_only parameter, but it doesn't seem to be needed to load offline. Is there any merit to adding the parameter?

@lstein lstein merged commit 9f8f996 into invoke-ai:main Jan 4, 2026
25 checks passed
@VoSed
Copy link

VoSed commented Jan 4, 2026

all models loaded and ran with the internet disconnected.

In case of my issue, models loaded fine if internet just disconnected. But when it's connected, but HuggingFace is unreachable, then models unable to load.

@Pfannkuchensack
Copy link
Collaborator Author

I think the problem is the config HuggingFace wants is gone(?) and that is the problem if the parameter is not there it will fail.

@VoSed
Copy link

VoSed commented Jan 4, 2026

I think the problem is the config HuggingFace wants is gone(?)

It was because my Internet Service Provider blocking access to Cloudflare Protection Services. All other services that relies on Cloudflare could not be accessible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend PRs that change backend files python PRs that change python files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants