Skip to content

Bidirectional checkpoint conversion - #14738

Open
hlky wants to merge 1 commit into
huggingface:mainfrom
hlky:bidirectional-checkpoint-conversion
Open

Bidirectional checkpoint conversion#14738
hlky wants to merge 1 commit into
huggingface:mainfrom
hlky:bidirectional-checkpoint-conversion

Conversation

@hlky

@hlky hlky commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

PR adds bidirectional checkpoint conversion.

e.g.

from diffusers.loaders.conversion import get_conversion

conversion = get_conversion("FluxTransformer2DModel", config)
original = conversion.to_original(diffusers_state)
restored = conversion.to_diffusers(original)

Core implementation in

src\diffusers\loaders\conversion\core.py
src\diffusers\loaders\conversion\io.py
src\diffusers\loaders\conversion\transforms.py

Per model conversion code under src\diffusers\loaders\conversion\*.py

scripts/convert_* refactored to scripts/recipes/*.py - these are "pipeline level", whereas scripts/convert_checkpoint.py is "model level", convert_checkpoint works both ways.

FromOriginalModelMixin added where appropriate.

single_file_utils.py also refactored to use loaders/conversion

Motivation: I needed something similar for DinoML.

Fixes #10076

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@github-actions github-actions Bot added size/L PR with diff > 200 LOC fixes-issue documentation Improvements or additions to documentation models tests pipelines single-file and removed size/L PR with diff > 200 LOC fixes-issue labels Sep 8, 2026
@hlky

hlky commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

cc @yiyixuxu @sayakpaul

@sayakpaul

Copy link
Copy Markdown
Member

Cc: @DN6

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

Labels

documentation Improvements or additions to documentation models pipelines single-file tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do we have any script covert from hf format to orginal format?

2 participants