Repository navigation
Conversation
A prior optimization to replace_key() deleted and re-added the key, which appended it at the end of the dict instead of preserving its original position. This broke checkpoint ordering when a model's title changes after calculate_shorthash(). Restore order-preserving behavior while also handling collisions with an existing new_key. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
pminko101
force-pushed
the
pminko101-aria-gpt
branch
from
September 10, 2026 16:10
d0970d2 to
267417d
Compare
Collaborator
|
please stop |
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.
Why
A prior "optimization" to
replace_key()inmodules/sd_models.pyreplaced the O(n) key-reordering logic with a simple delete-then-reinsert. That change relied on Python's dict insertion order, but a re-inserted key is appended at the end of the dict rather than staying at its original position. This silently broke checkpoint list ordering whenever a model's title changes aftercalculate_shorthash()is called (e.g. checkpoint dropdown/API ordering shifting unexpectedly).What changed
Restored order-preserving key replacement in
replace_key():new_keyalready exists elsewhere in the dict (removes the stale entry first) so no duplicate/orphaned entries can occur.Notes for reviewers
CheckpointInfo.calculate_shorthash()is the only call site) beyond fixing the ordering regression.