Download code/tt_depthpro2/tests/conftest.py from changh95/DepthPro2: direct link, hf CLI and curl.
- Browser
- Download file 613 Bytes
-
https://huggingface.co/changh95/DepthPro2/resolve/main/code/tt_depthpro2/tests/conftest.py
- Command line
-
hf download hf://changh95/DepthPro2/code/tt_depthpro2/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/changh95/DepthPro2/resolve/main/code/tt_depthpro2/tests/conftest.py
613 Bytes
| # SPDX-License-Identifier: Apache-2.0 | |
| """Fixtures of the DepthPro2 tests (host and device). The package root (``code/``) is put on ``sys.path``; the host | |
| tests' torch thread count is ``DEPTHPRO2_TEST_THREADS`` (default 8).""" | |
| import os | |
| import sys | |
| import pytest | |
| CODE = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| if CODE not in sys.path: | |
| sys.path.insert(0, CODE) | |
| def _threads(): | |
| try: | |
| import torch | |
| except ImportError: | |
| return | |
| torch.set_num_threads(int(os.environ.get("DEPTHPRO2_TEST_THREADS", "8"))) | |