From 5774967e66b273a15470f141c6ec09a6a363012a Mon Sep 17 00:00:00 2001 From: Manuel Candales Date: Wed, 4 Feb 2026 23:22:57 -0500 Subject: [PATCH] Update [ghstack-poisoned] --- backends/apple/metal/tests/test_modules.py | 23 ++++------------------ 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/backends/apple/metal/tests/test_modules.py b/backends/apple/metal/tests/test_modules.py index 086e0d9a7fe..eefcd15b69f 100644 --- a/backends/apple/metal/tests/test_modules.py +++ b/backends/apple/metal/tests/test_modules.py @@ -31,15 +31,10 @@ from torch.export import export from torch.nn.attention import SDPBackend -try: - # Need to import to load the ops - import torchao.experimental.ops.mps # noqa: F401 - from torchao.experimental.quant_api import UIntxWeightOnlyConfig - from torchao.quantization.quant_api import quantize_ - - TORCHAO_AVAILABLE = True -except ImportError: - TORCHAO_AVAILABLE = False +# Need to import to load the ops +import torchao.experimental.ops.mps # noqa: F401 +from torchao.experimental.quant_api import UIntxWeightOnlyConfig +from torchao.quantization.quant_api import quantize_ # Check if MPS is available for export tests @@ -246,7 +241,6 @@ def forward(self, x: torch.Tensor): "rtol_float32": 5e-2, "atol_bfloat16": 1e-1, "rtol_bfloat16": 1e-1, - "skip": not TORCHAO_AVAILABLE, } @@ -271,7 +265,6 @@ def forward(self, x: torch.Tensor): "rtol_float32": 5e-2, "atol_bfloat16": 1e-1, "rtol_bfloat16": 1e-1, - "skip": not TORCHAO_AVAILABLE, } @@ -296,7 +289,6 @@ def forward(self, x: torch.Tensor): "rtol_float32": 5e-2, "atol_bfloat16": 1e-1, "rtol_bfloat16": 1e-1, - "skip": not TORCHAO_AVAILABLE, } @@ -321,7 +313,6 @@ def forward(self, x: torch.Tensor): "rtol_float32": 5e-2, "atol_bfloat16": 1e-1, "rtol_bfloat16": 1e-1, - "skip": not TORCHAO_AVAILABLE, } @@ -346,7 +337,6 @@ def forward(self, x: torch.Tensor): "rtol_float32": 5e-2, "atol_bfloat16": 1e-1, "rtol_bfloat16": 1e-1, - "skip": not TORCHAO_AVAILABLE, } @@ -698,11 +688,6 @@ def quantize_model(model: nn.Module, qlinear: str, qlinear_group_size: int = 32) - "fpa4w": Floating point activation, 4-bit weight (Metal backend) qlinear_group_size: Group size for quantization (default: 32). """ - if not TORCHAO_AVAILABLE: - raise RuntimeError( - "torchao is not available. Install torchao to use quantization." - ) - if qlinear == "fpa4w": linear_config = UIntxWeightOnlyConfig( group_size=qlinear_group_size,