pytorch / pytorch/executorch

CoreML quantizer does not work if model has nn.Embedding

Open
#9,969 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

actionable triaged
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🚀 The feature, motivation and pitch

CoreML fails during lowering when the model has an embedding op and the CoreML quantizer is used.

quantization_config = LinearQuantizerConfig.from_dict(
    {
        "global_config": {
            "quantization_scheme": QuantizationScheme.symmetric,
            "activation_dtype": torch.quint8,
            "weight_dtype": torch.qint8,
            "weight_per_channel": True,
        }
    }
)
quantizer = CoreMLQuantizer(quantization_config)
prepared_graph = prepare_pt2e(pre_autograd_aten_dialect, quantizer)
Alternatives

No response

Additional context

No response

RFC (Optional)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names CoreMLQuantizer, LinearQuantizerConfig, prepare_pt2e, and nn.Embedding; start by reproducing the lowering failure with the shown configuration and tracing the CoreML lowering path for the embedding operation. Done means the same embedding model lowers successfully with CoreML quantization without the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.