Skip to content

convert : sort and use file parts from model index if present#18043

Merged
CISC merged 3 commits intomasterfrom
cisc/convert-safetensors-keep-order
Dec 18, 2025
Merged

convert : sort and use file parts from model index if present#18043
CISC merged 3 commits intomasterfrom
cisc/convert-safetensors-keep-order

Conversation

@CISC
Copy link
Member

@CISC CISC commented Dec 14, 2025

Follow up to #17286

The previous PR made tensor order more random than necessary, if there's an index, keep the same file orderuse a sorted list of all unique file parts from there, if not keep the sorted order from get_model_part_names for consistent conversions.

@CISC
Copy link
Member Author

CISC commented Dec 17, 2025

@ngxson gentle ping

Copy link
Contributor

@ngxson ngxson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, I think it's probably better to make this whole index_tensors() function to be less complicated, by refactor it into 3 separated cases (can be done in a follow-up PR):

  • safetensors non-mistral --> most models use this
  • safetensors mistral --> probably expose as a function that can be override by subclass, similar to modify_tensors()
  • .bin file

@CISC CISC changed the title convert : keep file part order from model index convert : sort and use file parts from model index if present Dec 18, 2025
@CISC CISC merged commit 9cff4cc into master Dec 18, 2025
9 checks passed
@CISC CISC deleted the cisc/convert-safetensors-keep-order branch December 18, 2025 06:54
Anico2 added a commit to Anico2/llama.cpp that referenced this pull request Jan 15, 2026
…rg#18043)

* keep file part order from model index

* treat index as authoritative

* sort index parts
blime4 referenced this pull request in blime4/llama.cpp Feb 5, 2026
* keep file part order from model index

* treat index as authoritative

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

Labels

python python script changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants