Skip to content

Model saver code deduplication#1518

Open
dxqb wants to merge 2 commits into
Nerogar:masterfrom
dxqb:save-pipeline-dtype-util
Open

Model saver code deduplication#1518
dxqb wants to merge 2 commits into
Nerogar:masterfrom
dxqb:save-pipeline-dtype-util

Conversation

@dxqb

@dxqb dxqb commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Minor code deduplication, to avoid having to copy this from model-to-new-model

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

part of #1203

dxqb and others added 2 commits June 13, 2026 14:47
Several model savers (Ernie, Flux2, Z-Image, ...) duplicate the same
deepcopy + tokenizer __deepcopy__ workaround to produce a dtype-converted
copy of a diffusers pipeline for saving. Extract it into a shared helper
so new savers can reuse it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a tokenizer_attrs parameter (default ("tokenizer",)) so savers with
extra/different tokenizer attributes (Flux's tokenizer_2, SD3's
tokenizer_3, HiDream's tokenizer_3/tokenizer_4) can use the same helper.
Replaces the duplicated deepcopy + tokenizer __deepcopy__ workaround in
Chroma, Ernie, Flux, Flux2, HiDream, HunyuanVideo, PixArtAlpha, Qwen,
Sana, StableDiffusion3 and Z-Image with calls to the shared helper.
No behavior change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dxqb dxqb added the preview merged in the preview branch label Jun 13, 2026
dxqb added a commit that referenced this pull request Jun 14, 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