Download code/conftest.py from changh95/DeepSeek-OCR: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/changh95/DeepSeek-OCR/resolve/main/code/conftest.py
- Command line
-
hf download hf://changh95/DeepSeek-OCR/code/conftest.py
-
curl -L -o conftest.py https://huggingface.co/changh95/DeepSeek-OCR/resolve/main/code/conftest.py
1.72 kB
| # SPDX-License-Identifier: Apache-2.0 | |
| # Adapted from this workspace's GLM-OCR bundle (code/conftest.py, Apache-2.0). | |
| """pytest settings of DeepSeek-OCR (no dependency on tt-metal's own conftest). | |
| - Host tests (``tt_dsocr/tests/test_host_*.py``) never open a device (the fake backend; a fake chip for the server's | |
| open / close path): ``TT_VISIBLE_DEVICES=none python -m pytest -q code/tt_dsocr/tests/test_host_server.py``. Tests | |
| that need the checkpoint's tokenizer (``DSOCR_MODEL_DIR``) or the development goldens (``DSOCR_ASSETS``) skip when | |
| they are absent; ``DSOCR_TEST_CPU=1`` adds a CPU reference run. | |
| - Device checks (``tt_dsocr/tests/dev_*.py``) are scripts, run one at a time through the device lock on the shared | |
| workspace box: ``bin/devrun -t 1500 -- python -u code/tt_dsocr/tests/dev_e2e.py ...``. | |
| - Tests marked ``device`` are skipped when ttnn is missing or ``TT_VISIBLE_DEVICES=none``. | |
| """ | |
| from __future__ import annotations | |
| import gc | |
| 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 item in items: | |
| if "device" in item.keywords: | |
| item.add_marker(skip) | |
| def _gc_between_tests(): | |
| gc.collect() | |