-
Notifications
You must be signed in to change notification settings - Fork 607
Bump torchao pin, adjust llama export to support pre-quantization via quantize_ (phi4-mini load/export) #10142
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10142
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 74a6aee with merge base cd72ec0 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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 on et side, few comments
output_dir=".", | ||
model_type="PHI4", | ||
) | ||
if os.path.isdir(input_dir_or_checkpoint): |
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.
Can we add an comment somewhere explicitly detailing that:
FullModelHFCheckpointer
is for directory (which would be straight from HF)phi_4_hf_to_meta
is used for single checkpoint, and the use case is for prequantized checkpoints
examples/models/llama/model.py
Outdated
@@ -257,6 +258,9 @@ def __init__(self, **kwargs): | |||
strict=False, | |||
assign=True, | |||
) # self.model_ = Transformer(gptconf) | |||
for param in self.model_.parameters(): | |||
if isinstance(param, TorchAOBaseTensor): | |||
param.requires_grad = False |
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.
I think might as well requires_grad = False
across the board, not just for TorchAOBaseTensor
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.
I'm not sure if on-device training stuff might not want that
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.
XNNPACK parts look ok
Fixing compile issues here: pytorch/ao#2063 |
@metascroy has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
@metascroy has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@metascroy has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@metascroy has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
… quantize_ (phi4-mini load/export) Differential Revision: D73147002 Pull Request resolved: pytorch#10142
This makes changes to ET so that phi-4 checkpoints saved with:
can load into ET and export and lower to XNNPACK.
cc @mcr229 for XNNPACK changes. The require changes are if ZeroPointDomain is NONE, then the zero_point is serialized as None, rather than a tensor of zeros.
cc @jackzhxng for phi4-mini changes
Output of phi4 model in ExecuTorch with above quantization: