Download code/tt_paddleocr/tests/_weights.py from changh95/PaddleOCR-VL: direct link, hf CLI and curl.
- Browser
- Download file 874 Bytes
-
https://huggingface.co/changh95/PaddleOCR-VL/resolve/main/code/tt_paddleocr/tests/_weights.py
- Command line
-
hf download hf://changh95/PaddleOCR-VL/code/tt_paddleocr/tests/_weights.py
-
curl -L -o _weights.py https://huggingface.co/changh95/PaddleOCR-VL/resolve/main/code/tt_paddleocr/tests/_weights.py
874 Bytes
| # SPDX-License-Identifier: Apache-2.0 | |
| """Where host tests find checkpoint files (optional; tests that need them skip otherwise): ``PADDLEOCR_TEST_WEIGHTS`` | |
| (a checkpoint dir) or the profile's pinned snapshot in the Hugging Face cache (no download).""" | |
| import os | |
| from typing import Optional | |
| from ..config import WEIGHTS | |
| def repo_file(name: str, profile: str = "1.6") -> Optional[str]: | |
| d = os.environ.get("PADDLEOCR_TEST_WEIGHTS") | |
| if d: | |
| p = os.path.join(d, name) | |
| return p if os.path.isfile(p) else None | |
| try: | |
| from huggingface_hub import try_to_load_from_cache | |
| repo, rev = WEIGHTS[profile] | |
| p = try_to_load_from_cache(repo, name, revision=rev) | |
| return p if isinstance(p, str) and os.path.isfile(p) else None | |
| except Exception: # noqa: BLE001 -- no huggingface_hub / no cache: the test skips | |
| return None | |