-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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-llama-ggmlv3-to-gguf: Try to handle files older than GGJTv3 #3023
convert-llama-ggmlv3-to-gguf: Try to handle files older than GGJTv3 #3023
Conversation
Better error messages for files that cannot be converted Add file type to GGUF output
I'll hold off merging this for a bit until I get some feedback from the people with older GGML files. |
Isn't the name of the script technically inaccurate now? Maybe we should at least add something to --help to indicate to users that certain pre-GGMLv3 files are supported as well. |
Not just technically. :) I kind of wanted to just rename it, but I felt like that would be pretty confusing for existing users.
Sure, that's not a bad idea. It seems like for the most part, users don't really know the exact type of file they have anyway and will just try to run the script but some additional information certainly can't hurt. |
You know what, I think I will just rename the file since |
Include original file type information in description
convert-llama-ggml-to-gguf.py
Outdated
if (self.file_format < GGMLFormat.GGJT or self.format_version < 2) and ftype not in (GGMLFType.ALL_F32, GGMLFType.MOSTLY_F16): | ||
raise ValueError(f'Quantizations changed in GGJTv2. Can only convert unquantized GGML files older than GGJTv2. Sorry, your {self.file_format.name}v{self.format_version} file of type {ftype.name} is not eligible for conversion.') | ||
if (self.file_format == GGMLFormat.GGJT and self.format_version == 2) and ftype in (GGMLFType.MOSTLY_Q4_0, GGMLFType.MOSTLY_Q4_1, GGMLFType.MOSTLY_Q4_1_SOME_F16, GGMLFType.MOSTLY_Q8_0): | ||
raise ValueError(f'Q4 and Q8 quantizations changed in GGJTv3. Sorry, your {self.file_format.name}v{self.format_version} file of type {ftype.name} is not eligible for conversion.') |
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.
Lines of code should be at most 120 chars wide, for readability:
if (self.file_format < GGMLFormat.GGJT or self.format_version < 2) and ftype not in (GGMLFType.ALL_F32, GGMLFType.MOSTLY_F16): | |
raise ValueError(f'Quantizations changed in GGJTv2. Can only convert unquantized GGML files older than GGJTv2. Sorry, your {self.file_format.name}v{self.format_version} file of type {ftype.name} is not eligible for conversion.') | |
if (self.file_format == GGMLFormat.GGJT and self.format_version == 2) and ftype in (GGMLFType.MOSTLY_Q4_0, GGMLFType.MOSTLY_Q4_1, GGMLFType.MOSTLY_Q4_1_SOME_F16, GGMLFType.MOSTLY_Q8_0): | |
raise ValueError(f'Q4 and Q8 quantizations changed in GGJTv3. Sorry, your {self.file_format.name}v{self.format_version} file of type {ftype.name} is not eligible for conversion.') | |
if ($ | |
(self.file_format < GGMLFormat.GGJT or self.format_version < 2)$ | |
and ftype not in (GGMLFType.ALL_F32, GGMLFType.MOSTLY_F16)$ | |
):$ | |
raise ValueError($ | |
'Quantizations changed in GGJTv2. Can only convert unquantized GGML files older than GGJTv2. Sorry, '$ | |
f'your {self.file_format.name}v{self.format_version} file of type {ftype.name} is not eligible for '$ | |
'conversion.'$ | |
)$ | |
if ($ | |
self.file_format == GGMLFormat.GGJT and self.format_version == 2$ | |
and ftype in ($ | |
GGMLFType.MOSTLY_Q4_0, GGMLFType.MOSTLY_Q4_1, GGMLFType.MOSTLY_Q4_1_SOME_F16, GGMLFType.MOSTLY_Q8_0,$ | |
)$ | |
):$ | |
raise ValueError($ | |
f'Q4 and Q8 quantizations changed in GGJTv3. Sorry, your {self.file_format.name}v{self.format_version} '$ | |
f'file of type {ftype.name} is not eligible for conversion.'$ | |
) |
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.
Thanks for the feedback.
In this particular case, I'm honestly not sure putting the time into improving the formatting is really worth it. I doubt anyone else is going to be messing with this script, and it's probably not even going to be in the repo in a month or so. But I made some formatting cleanups anyway.
Formatting changes to clean up some long lines
Better error messages for files that cannot be converted
Add file type to GGUF output
Closes #2990