Skip to content

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

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

CISC merged 3 commits into
masterfrom
cisc/convert-safetensors-keep-order

Conversation

@CISC

@CISC CISC commented Dec 14, 2025 •

Copy link
Copy Markdown
Member

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.

Comment thread convert_hf_to_gguf.py Resolved
@CISC

CISC commented Dec 17, 2025

Copy link
Copy Markdown
Member Author

@ngxson gentle ping

@ngxson ngxson left a comment •

Copy link
Copy Markdown
Collaborator

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

Comment thread convert_hf_to_gguf.py Resolved
Comment thread convert_hf_to_gguf.py Resolved
@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
@CISC
CISC deleted the cisc/convert-safetensors-keep-order branch December 18, 2025 06:54
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
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
…rg#18043)

* keep file part order from model index

* treat index as authoritative

* sort index parts
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
…rg#18043)

* keep file part order from model index

* treat index as authoritative

* sort index parts
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
…rg#18043)

* keep file part order from model index

* treat index as authoritative

* sort index parts
MrLordCat referenced this pull request in MrLordCat/llama.cpp-rdna-lab Jul 16, 2026
* keep file part order from model index

* treat index as authoritative

* sort index parts
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
…rg#18043)

* 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