macOS wheel: libquantized_ops_aot_lib.dylib never loads, so PT2E models fail later with "Missing out variants"
@JakeStevens đang làm issue này rồi.
Từ ngày 1/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Summary
On the macOS arm64 wheel, libquantized_ops_aot_lib.dylib cannot be loaded, so the quantized_decomposed out-variants are never registered. Nothing reports it — the load sits in a bare except: that logs at INFO — and the first sign is to_executorch() failing on a model with nothing obviously wrong with it.
executorch 1.4.0, torch 2.13.0, Python 3.12, macOS arm64, installed from the pip wheel. I have not checked the Linux wheels or a source build.
What you see
RuntimeError: Missing out variants: {'quantized_decomposed::dequantize_per_channel',
'quantized_decomposed::choose_qparams', 'quantized_decomposed::dequantize_per_tensor'}
It happens for any PT2E-quantized graph that leaves a q/dq node outside the delegate. Grounding DINO tiny is a good example of how little it takes: dynamic int8 quantises 350 of its 392 aten.linear nodes, XnnpackPartitioner takes 71.5% of the graph, and exactly three quantized ops end up on the portable path —
quantized_decomposed.dequantize_per_channel.default : 1
quantized_decomposed.choose_qparams.tensor : 1
quantized_decomposed.dequantize_per_tensor.tensor : 1
— the same three the error names. One linear out of 392 not taken by the delegate is enough to stop the export. Models that delegate everything never see this, which is why it can sit unnoticed.
Cause
$ python -c "import ctypes; ctypes.CDLL('.../executorch/kernels/quantized/libquantized_ops_aot_lib.dylib')"
OSError: dlopen(...libquantized_ops_aot_lib.dylib, 0x0006):
Library not loaded: @rpath/_portable_lib.cpython-312-darwin.so
Referenced from: .../executorch/kernels/quantized/libquantized_ops_aot_lib.dylib
otool -L confirms the reference. The @rpath does not resolve from executorch/kernels/quantized/, and executorch/kernels/quantized/__init__.py wraps torch.ops.load_library in
except:
import logging
logging.info("libquantized_ops_aot_lib is not loaded")
so the failure is invisible at the point where it happens.
Workaround
Put _portable_lib in the process first; the dylib then finds it by install name.
import torch
from executorch.extension.pybindings import portable_lib # noqa: F401
from pathlib import Path
import executorch.kernels.quantized as q
torch.ops.load_library(str(next(Path(q.__file__).parent.glob("**/*quantized_ops_aot_lib.*"))))
After that torch.ops.quantized_decomposed carries choose_qparams, dequantize_per_channel and dequantize_per_tensor, and the same export completes — the Grounding DINO run above goes from the error to a 254 MB .pte with nothing else changed.
Suggestions
- Give the dylib an rpath that reaches
extension/pybindings, so it loads on its own. - Whatever the packaging does, do not swallow the exception. A warning naming the dylib would have turned a confusing
Missing out variantsinto a one-line fix.
Happy to send a PR for either.
cc @kimishpatel @jerryzh168 @metascroy @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani
- Ngôn ngữ chính
- Python
- Star
- 5k
- Fork
- 1.2k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 588
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pytorch/executorch
-
enhancement triaged
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 68/100
pytorch/executorch#21640 ·
-
enhancement module: cuda module: examples module: mlx module: vulkan module: xnnpack
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
pytorch/executorch#23131 · 1 reaction ·
-
bug module: qnn module: quantization
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
pytorch/executorch#23108 ·
-
good first issue module: examples module: webgpu
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
pytorch/executorch#23099 ·
-
good first issue module: examples module: vulkan
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
pytorch/executorch#23098 ·
Tất cả issue của pytorch/executorch
Issue tương tự
-
agent-ready documentation needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Add https://search.jeremyh.xyz/ Đang mởinstance instance add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
searxng/searx-instances#939 · 1 bình luận ·
-
area-deployment area-integrations triage:bot-seen
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 86/100