Extract shared transformer-loading helper#1618
Open
dxqb wants to merge 1 commit into
Open
Conversation
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>
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
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-filespassesAI assistance