Skip to content

Extract shared transformer-loading helper#1618

Open
dxqb wants to merge 1 commit into
Nerogar:masterfrom
dxqb:loader-submodule-helpers
Open

Extract shared transformer-loading helper#1618
dxqb wants to merge 1 commit into
Nerogar:masterfrom
dxqb:loader-submodule-helpers

Conversation

@dxqb

@dxqb dxqb commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extracts the transformer / text-encoder / vae loading logic duplicated across the per-model loaders into shared helpers on HFModelLoaderMixin:

Pure refactor otherwise, no behavior change. For use in future PR

Test plan

  • pre-commit run --all-files passes
  • Launched the affected UI or script and exercised the change
  • Tested with at least one real preset / config when relevant (note which: ____)

AI assistance

  • AI-assisted — I have read every line in this diff and can defend each change

Extracts the transformer / text-encoder / vae loading logic duplicated
across the per-model loaders into shared helpers on HFModelLoaderMixin:

- _load_transformer: the from_single_file(..., quantization_config=
  GGUFQuantizationConfig(...)) / else-load-from-repo pattern for loading
  an optionally-GGUF-quantized transformer checkpoint, previously
  duplicated across 9 loaders.
- _load_text_encoder: thin wrapper over _load_transformers_sub_module
  giving every loader one call site for the load-on-demand streaming
  branch to hook.
- _load_vae: collapses the duplicated "separate vae repo overrides the
  base vae subfolder" branch across 15 diffusers-path loaders.

Flux's separate-transformer/pipeline path and HunyuanVideo's ckpt path
use structurally different else-branches and were left untouched, as
were the safetensors/pipeline-sourced vae branches.

Also fixes Ideogram's VAE Override being silently ignored (model_names.
vae_model was never read by the loader) and a HiDream text_encoder_4
override regression introduced while switching to _load_text_encoder
(the override repo holds text_encoder_4 at its root with no subfolder).

Pure refactor otherwise, no behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dxqb dxqb added the preview merged in the preview branch label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview merged in the preview branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant