-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Move convert.py to examples/convert-legacy-llama.py #7430
Conversation
We should update readme instructions, |
No torch? My understanding is that it's for safetensors |
docs/HOWTO-add-model.md
Outdated
@@ -17,7 +17,7 @@ Also, it is important to check that the examples and main ggml backends (CUDA, M | |||
### 1. Convert the model to GGUF | |||
|
|||
This step is done in python with a `convert` script using the [gguf](https://pypi.org/project/gguf/) library. | |||
Depending on the model architecture, you can use either [convert.py](../convert.py) or [convert-hf-to-gguf.py](../convert-hf-to-gguf.py). | |||
Depending on the model architecture, you can use either [convert-hf-to-gguf.py](../convert-hf-to-gguf.py) or [examples/convert-no-torch.py](../examples/convert-no-torch.py) (for `llama/llama2` models in `.pth` format). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that .pth stands for pytorch, I think this name could be misleading. Why not call it convert-llama.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convert-legacy-llama.py
maybe? I'd like to avoid giving impression that it can be used for converting llama 3
No torch as in no |
Relevant huggingface space PR https://huggingface.co/spaces/ggml-org/gguf-my-repo/discussions/68 |
I always just named it |
examples/convert-no-torch.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convert-hf-to-gguf.py
imports should be changed to reflect the rename
llama.cpp/convert-hf-to-gguf.py
Line 27 in 88e06d0
from convert import LlamaHfVocab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be moved to vocab.py
. Anything related to the vocab that's still needed.
Hmmmm... Do we have a conversion reference table so people can identify what file type to use with each script? If not for code repo docs maybe that's a wiki entry |
Not against this idea as convert.py is indeed a bit confusing, but this PR is still appearing broken with the CI. I do wonder if we could somehow consolidate all these into one convert.py... and have convert.py call specific convert-*.py based on detection of the model source etc... |
If you decide to go though the consolidation approach, see if you can also consolidate some aspect like how we generate default naming convention gguf. This will make it easier to update it as the standards evolve. |
Vocab factory is missing too. Not sure how to handle that yet. |
I don't think there's any use for vocab factory in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. But I think https://huggingface.co/spaces/ggml-org/gguf-my-repo/discussions/68 should be merged first to avoid breaking that HF space.
Awesome! I've been waiting for this to be merged so I can integrate this into my PR. This will be incredibly useful so I don't need to duplicate or reinvent APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoping this wont break my PR #7499 (review)
Looks like a good idea and good to refactor at this stage. Let's merge in once the hugging face PR gets merged in.
But let's merge if hf have not merged theirs in still by the time the main branch is stable.
Heya! @mofosyne, @Galunid and @ggerganov - I just merged a PR (https://huggingface.co/spaces/ggml-org/gguf-my-repo/discussions/73) to default to the convert-hf script. Good from my side to merge this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, thanks a ton for taking this up and opening the PR! 🤗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's now or never. Let's see how many convert.py PRs we have to fix, but looking forward to a cleaner codebase.
There's little use for this one, and a lot of confusion.