Skip to content

Qwen 3.5 MoE: Add --backend metal export path#18880

Merged
manuelcandales merged 53 commits intomainfrom
gh/manuelcandales/175/head
Apr 21, 2026
Merged

Qwen 3.5 MoE: Add --backend metal export path#18880
manuelcandales merged 53 commits intomainfrom
gh/manuelcandales/175/head

Conversation

@manuelcandales
Copy link
Copy Markdown
Contributor

Adds Metal backend support to export.py via --backend metal flag:

  • _prepare_and_quantize_metal: applies source transforms, quantizes
    experts to MLX affine INT4, quantizes non-expert layers with fpa4w
    (skips shared_expert_gate with N<4 for prefill compatibility)
  • _export_metal: exports decode + prefill methods via MetalBackend/
    MetalPartitioner

CUDA and MLX paths are unchanged.

Authored with Claude.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@manuelcandales manuelcandales requested a review from lucylq as a code owner April 14, 2026 16:25
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 14, 2026

🔗 Helpful Links

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

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

⏳ No Failures, 46 Pending

As of commit c53ecc6 with merge base 9600f63 (image):
💚 Looks good so far! There are no failures yet. 💚

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

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@manuelcandales manuelcandales removed the request for review from lucylq April 15, 2026 15:14
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Base automatically changed from gh/manuelcandales/174/head to main April 21, 2026 18:12
[ghstack-poisoned]
@github-actions
Copy link
Copy Markdown

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.

@manuelcandales manuelcandales merged commit 799bf5a into main Apr 21, 2026
191 of 193 checks passed
@manuelcandales manuelcandales deleted the gh/manuelcandales/175/head branch April 21, 2026 18:38
lucylq pushed a commit that referenced this pull request Apr 21, 2026
Adds Metal backend support to export.py via --backend metal flag:
- _prepare_and_quantize_metal: applies source transforms, quantizes
  experts to MLX affine INT4, quantizes non-expert layers with fpa4w
  (skips shared_expert_gate with N<4 for prefill compatibility)
- _export_metal: exports decode + prefill methods via MetalBackend/
  MetalPartitioner

CUDA and MLX paths are unchanged.
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.

2 participants