Download code/conftest.py from changh95/Kokoro-82M: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/changh95/Kokoro-82M/resolve/main/code/conftest.py
- Command line
-
hf download hf://changh95/Kokoro-82M/code/conftest.py
-
curl -L -o conftest.py https://huggingface.co/changh95/Kokoro-82M/resolve/main/code/conftest.py
1.36 kB
| # SPDX-License-Identifier: Apache-2.0 | |
| """pytest settings of Kokoro-82M (no dependency on tt-metal's own conftest). | |
| - Tests marked ``device`` are skipped when ttnn is missing or ``TT_VISIBLE_DEVICES=none``. | |
| - Host tests (``tests/test_host_*.py``) never open a device: ``TT_VISIBLE_DEVICES=none python -m pytest | |
| code/tt_kokoro/tests/test_host_*.py``. Tests that need the weights read ``KOKORO_WEIGHTS`` (a local | |
| hexgrad/Kokoro-82M snapshot; default: the pinned snapshot in the Hugging Face cache) and skip without them; the | |
| golden checks read ``KOKORO_GOLDEN`` (the official fp32 outputs of the gate cases) and skip without it. | |
| """ | |
| from __future__ import annotations | |
| import importlib.util | |
| import os | |
| import pytest | |
| def pytest_configure(config): | |
| config.addinivalue_line("markers", "device: needs a Tenstorrent chip (skipped on host-only runs)") | |
| def _no_device_reason(): | |
| if os.environ.get("TT_VISIBLE_DEVICES", "").lower() == "none": | |
| return "TT_VISIBLE_DEVICES=none (host-only run)" | |
| if importlib.util.find_spec("ttnn") is None: | |
| return "ttnn is not installed" | |
| return None | |
| def pytest_collection_modifyitems(config, items): | |
| reason = _no_device_reason() | |
| if reason: | |
| skip = pytest.mark.skip(reason=reason) | |
| for it in items: | |
| if "device" in it.keywords: | |
| it.add_marker(skip) | |