Repository navigation
test: add env-no-coreai and requires_coreai marker - #181
dengqiaoyu wants to merge 1 commit into
Conversation
|
|
||
| import pytest | ||
|
|
||
| pytest.importorskip("coreai") |
There was a problem hiding this comment.
coreai_utils loads coreai at import time, so nothing in tests/coreai_utils/ can be imported without it. Adding it to the conftest of coreai_utils skips the entire directory.
|
|
||
| import pytest | ||
|
|
||
| pytest.importorskip("coreai") |
There was a problem hiding this comment.
Same -- Why do we skip here?
There was a problem hiding this comment.
Same as the reply above: almost all the tests under this directory need coreai packages. There are some tests that only need CoreML, but making them more fine-grained adds additional complexity; therefore, I just skip the entire directory. Export tests should only be run in the full venv with coreai.
- Add `make env-no-coreai`, which sets up the default env without the `coreai` extra, and a `linux-tests-no-coreai` CI job that runs `make env-no-coreai test`
- Add the `requires_coreai` marker in `tests/config/plugin.py`; marked tests skip at collection when coreai is not installed, while test files that import coreai at the top use `pytest.importorskip("coreai")`
- Reword the Core AI export `ImportError` to name the `coreai` extra and `ExportBackend.Torch`
| error_message = ( | ||
| "coreai-torch package is required for MLIR export. " | ||
| "Install it with: pip install coreai-torch" | ||
| "Core AI export needs the optional coreai and coreai-torch packages; install them " |
There was a problem hiding this comment.
Should we also add a "requires CoreML" flag as well and change the venv to "make-env-no-coreai-no-coreml" (maybe not that long of a name but you get the point 😄 )
There was a problem hiding this comment.
That's a long name. I wonder if we should switch to something like "make env-basic" or "make env-core", and then the flag would become "require_extra_env". But this is not as intuitive as "make env-no-coreai" or "require_coreai".
| from coreai_opt.quantization.spec.qparams_calculator import StaticQParamsCalculator | ||
| from coreai_opt.quantization.spec.range_calculator import MinMaxRangeCalculator | ||
|
|
||
| # torch.compile raises on a Python that torch doesn't support yet. |
There was a problem hiding this comment.
Why is this a part of this PR?
There was a problem hiding this comment.
torch 2.14 currently doesn't support python 3.15 for torch.compile, see the its source code:
def check_if_dynamo_supported() -> None:
if sys.version_info >= (3, 15):
raise RuntimeError("Python 3.15+ not yet supported for torch.compile")
elif sysconfig.get_config_var("Py_GIL_DISABLED") == 1 and sys.version_info < (
3,
13,
3,
):
raise RuntimeError(
"torch.compile is not supported on Python < 3.13.3 built with GIL disabled. "
"Please use Python 3.13.3+."
)f7d666e to
305ad79
Compare
make env-no-coreai, which sets up the default env without thecoreaiextra, and alinux-tests-no-coreaiCI job that runsmake env-no-coreai testrequires_coreaimarker intests/config/plugin.py; marked tests skip at collection when coreai is not installed, while test files that import coreai at the top usepytest.importorskip("coreai")ImportErrorto name thecoreaiextra andExportBackend.Torch