introduce legacy-torch flag for backward compatibility on older Intel… #18908
+79
−34
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.
Intel-based Macs cannot upgrade PyTorch beyond version 2.2.2
Users with older Intel-based Macs cannot upgrade PyTorch beyond version 2.2.2, as Apple dropped support for these machines in newer macOS versions. The latest convert_hf_to_gguf.py fails on these systems with:
AttributeError: module 'torch' has no attribute 'uint64'
This occurs because torch.uint64, torch.uint32, and torch.uint16 were introduced in PyTorch 2.3.
As I love my 2013 Mac Pro I try to keep it useful as long as possible. I can fall back to the older types.
There are so many ways to do this but wanted to make it completely user driven with a '-legacy-torch' flag . I wanted to avoid any automatic fallback - user should know what they do and this is a "last resort" on older machines.
Usage
python3 convert_hf_to_gguf.py --legacy-torch /path/to/model --outfile output.gguf --outtype f16Other option would be maintaining a separate convert_hf_to_gguf_bw_comp script but I do not like that.
Please suggest if you have better suggestion to solve this.