Use foreach SGD in QAT example to fix static-analysis lint (#21031)#21031
Use foreach SGD in QAT example to fix static-analysis lint (#21031)#21031psiddh wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21031
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b49057d with merge base 44539fd ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@psiddh has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112638593. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Updates the Arm QAT example training loop to satisfy the missing_for_each_optimizer static-analysis lint by ensuring SGD uses the multi-tensor (foreach) implementation, aligning the example with recommended optimizer configuration.
Changes:
- Switch
torch.optim.SGD(...)construction inbuild_qat_modelto passforeach=True. - Reformat the optimizer constructor into a multi-line call for readability.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…1031) Summary: Follow-up to D112514521. That diff (a diff-train import of the Practical-RIFE PTQ/QAT accuracy flow) tripped the `missing_for_each_optimizer` CITRINE static-analysis lint at `qat_loop.py:689`: the QAT training loop constructed `torch.optim.SGD` without the foreach multi-tensor implementation. Add `foreach=True` to the `torch.optim.SGD` constructor in `build_qat_model` so the optimizer uses the multi-tensor path (estimated ~3.3% training speedup per the lint guidance). Applied to both the `fbcode` and `xplat` copies. Reviewed By: rascani Differential Revision: D112638593
15b8795 to
9cc01e5
Compare
…1031) Summary: Follow-up to D112514521. That diff (a diff-train import of the Practical-RIFE PTQ/QAT accuracy flow) tripped the `missing_for_each_optimizer` CITRINE static-analysis lint at `qat_loop.py:689`: the QAT training loop constructed `torch.optim.SGD` without the foreach multi-tensor implementation. Add `foreach=True` to the `torch.optim.SGD` constructor in `build_qat_model` so the optimizer uses the multi-tensor path (estimated ~3.3% training speedup per the lint guidance). Applied to both the `fbcode` and `xplat` copies. Reviewed By: rascani Differential Revision: D112638593
9cc01e5 to
b49057d
Compare
Summary:
Follow-up to D112514521. That diff (a diff-train import of the Practical-RIFE
PTQ/QAT accuracy flow) tripped the
missing_for_each_optimizerCITRINEstatic-analysis lint at
qat_loop.py:689: the QAT training loop constructedtorch.optim.SGDwithout the foreach multi-tensor implementation.Add
foreach=Trueto thetorch.optim.SGDconstructor inbuild_qat_modelso the optimizer uses the multi-tensor path (estimated ~3.3% training speedup
per the lint guidance). Applied to both the
fbcodeandxplatcopies.Reviewed By: rascani
Differential Revision: D112638593