convert : identify missing model files #9397
Merged
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.
Should fix #9245.
Previously, when models files (like
model-00002-of-00002.safetensors
) were missing, a cryptic error message was output, but not when only one model file was left.convert_hf_to_gguf.py
now reads the appropriate(model.safetensors|pytorch_model.bin).index.json
when it exists instead of only when there are more than one model file.I've also made the error message easier to understand by making it include a list of missing tensor files instead of the missing tensor names, when that information can be obtained from the index files.
This can be tested with
python3 convert_hf_to_gguf.py --dry-run /path/to/model_dir
by renaming the model files of multi-part models so that at least one of them doesn't matchmodel*.safetensors
orpytorch_model*.bin
.From my testing this seems to work correctly, and should proceed with conversion as before when all the tensors are present or if the index file is missing.
@mesibo Does this help with the problem you've noticed?