Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert : identify missing model files #9397

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

compilade
Copy link
Collaborator

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 match model*.safetensors or pytorch_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?


@compilade compilade added bugfix fixes an issue or bug python python script changes Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix labels Sep 10, 2024
@mesibo
Copy link

mesibo commented Sep 10, 2024

Thanks, it should, I will test it out.

Do you think the script should also validate the part sequence number for continuity, even if an index file is missing? For instance, should it throw an error or exit if seq != prev_seq + 1?

@compilade compilade added the merge ready indicates that this may be ready to merge soon and is just holding out in case of objections label Sep 14, 2024
@ggerganov ggerganov merged commit d54c21d into ggerganov:master Sep 16, 2024
9 checks passed
dsx1986 pushed a commit to dsx1986/llama.cpp that referenced this pull request Oct 29, 2024
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 15, 2024
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix fixes an issue or bug merge ready indicates that this may be ready to merge soon and is just holding out in case of objections python python script changes Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Missing Sanity Check in convert_hf_to_gguf.py
3 participants