Skip to content

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Nov 22, 2025

Summary

unwrap_tensor_subclass was not unwrapping nested lora linears. This meant qdata/scale/zero were bundled together in the subclass, and separated at run decompositions inside to_edge_transform_and_lower. This is after nodes are tagged, meaning that the scales were not tagged, and remained in the PTE file after the rest of the weights were moved to a PTD file.

It's recommended to move away from unwrap_tensor_subclass and rely on export + decomps. This PR adds a decomp after exporting in export_llama, and removes cases of unwrap_tensor_subclass.

TODO: remove all cases of unwrap_tensor_subclass in ET.

Test plan

Add check that quantized weights are in PTD file (not PTE file) after quantization. This is a simple check, nested linears seem to be the real issue that decomposing resolves. TODO to add a test for that (probably e2e test with stories in subsequent PR)

 python -m unittest executorch.backends.xnnpack.test.passes.test_propagate_custom_meta_pass

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 22, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15951

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 22, 2025
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@lucylq lucylq force-pushed the lfq.decomp-after-export branch from b48a57a to 3d09dc1 Compare November 24, 2025 21:58
@lucylq lucylq force-pushed the lfq.decomp-after-export branch from 3d09dc1 to 10783cb Compare November 24, 2025 22:35
@lucylq lucylq marked this pull request as ready for review November 24, 2025 22:35
@lucylq lucylq requested a review from metascroy November 24, 2025 22:35
@meta-codesync
Copy link

meta-codesync bot commented Nov 24, 2025

@lucylq has imported this pull request. If you are a Meta employee, you can view this in D87826410.

@metascroy
Copy link
Contributor

LGTM! Address any failing CI tests before landing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants