|
29 | 29 | if platform.system() == "Darwin": |
30 | 30 | from coreai.runtime import ComputeUnitKind, SpecializationOptions |
31 | 31 |
|
32 | | -# Substring of the dtype guard message raised by the CoreML export validation. Shared so |
33 | | -# test files asserting the rejection don't drift from one another. |
34 | | -COREML_DTYPE_REJECTION_MATCH = "CoreML export does not support" |
| 32 | +# Substring of the guard message raised by CoreML export validation (dtype or |
| 33 | +# granularity/config rejection). Shared so test files asserting the rejection |
| 34 | +# don't drift from one another. |
| 35 | +COREML_REJECTION_MATCH = "CoreML export does not support" |
35 | 36 |
|
36 | 37 | # Compute unit selection driven by the --compute-unit-kind pytest option (see |
37 | 38 | # tests/conftest.py). Default is "interpreter" so a plain `pytest` run uses the |
@@ -87,17 +88,18 @@ def _get_test_specialization_options() -> "SpecializationOptions | None": |
87 | 88 | raise ValueError(msg) |
88 | 89 |
|
89 | 90 |
|
90 | | -def assert_coreml_finalize_rejects_unsupported_dtype(finalizer: Any) -> None: |
91 | | - """Assert ``finalizer.finalize(backend=CoreML)`` rejects an unsupported dtype. |
| 91 | +def assert_coreml_finalize_rejects(finalizer: Any) -> None: |
| 92 | + """Assert ``finalizer.finalize(backend=CoreML)`` rejects an unsupported config. |
92 | 93 |
|
93 | 94 | CoreML does not support FP4, FP8, INT2, or UINT2 quantization or |
94 | | - palettization dtypes, so finalize must raise a ``CoreMLExportError`` rather |
95 | | - than emit an invalid model. |
| 95 | + palettization dtypes, nor per-channel/per-block activation quantization |
| 96 | + granularity, so finalize must raise a ``CoreMLExportError`` rather than |
| 97 | + emit an invalid model. |
96 | 98 |
|
97 | 99 | Args: |
98 | 100 | finalizer (Any): A prepared ``Quantizer`` or ``KMeansPalettizer``. |
99 | 101 | """ |
100 | | - with pytest.raises(CoreMLExportError, match=COREML_DTYPE_REJECTION_MATCH): |
| 102 | + with pytest.raises(CoreMLExportError, match=COREML_REJECTION_MATCH): |
101 | 103 | finalizer.finalize(backend=ExportBackend.CoreML) |
102 | 104 |
|
103 | 105 |
|
|
0 commit comments