Fix AttributeError when torchao ops are not registered#18008
Fix AttributeError when torchao ops are not registered#18008elpdumont wants to merge 1 commit intopytorch:mainfrom
Conversation
Summary: The `_QUANT_PRIMITIVES` list initialization in `util.py` catches `ImportError` when torchao is not installed, but fails to catch `AttributeError` when torchao is installed but the operators (`dequantize_affine`, `quantize_affine`, `choose_qparams_affine`) are not registered. This causes import failures in environments where torchao is available but an older version is used that doesn't have these operators registered. The fix adds `AttributeError` to the exception handler alongside `ImportError`. Differential Revision: D95735505
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18008
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New FailuresAs of commit a133516 with merge base 122fdef ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@elpdumont has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95735505. |
This PR needs a
|
Summary:
The
_QUANT_PRIMITIVESlist initialization inutil.pycatchesImportErrorwhen torchao is not installed, but fails to catchAttributeErrorwhen torchao is installed but the operators (dequantize_affine,quantize_affine,choose_qparams_affine) are not registered.This causes import failures in environments where torchao is available but an older version is used that doesn't have these operators registered.
The fix adds
AttributeErrorto the exception handler alongsideImportError.Differential Revision: D95735505