Download code/hamer/__init__.py from changh95/hamer-p150: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/changh95/hamer-p150/resolve/main/code/hamer/__init__.py
- Command line
-
hf download hf://changh95/hamer-p150/code/hamer/__init__.py
-
curl -L -o __init__.py https://huggingface.co/changh95/hamer-p150/resolve/main/code/hamer/__init__.py
1.57 kB
| # SPDX-FileCopyrightText: © 2026 Tenstorrent Inc. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """Tenstorrent Blackhole port of the HaMeR per-frame regressor. | |
| Python API (see ``PYTHON.md``):: | |
| from hamer import HamerModel | |
| with HamerModel.from_pretrained(device_id=0) as model: | |
| hand = model("frame.jpg", bbox=[x1, y1, x2, y2], is_right=True) | |
| Lower-level pieces (unchanged):: | |
| from hamer import Hamer, build_reference, build_from_reference, sample_input | |
| from hamer import load_hamer_checkpoint | |
| from hamer.preprocess import preprocess | |
| Importing the package does not import ``ttnn``; the device stack loads when a model is built. | |
| """ | |
| from __future__ import annotations | |
| import importlib | |
| from typing import Any | |
| from .api import HamerModel, HandPrediction, apply_served_config, load_reference, open_device | |
| __version__ = "0.1.0" | |
| _LAZY = { | |
| "Hamer": ".reference", | |
| "HamerConfig": ".reference", | |
| "build_reference": ".reference", | |
| "sample_input": ".reference", | |
| "TtHamer": ".model", | |
| "build_from_reference": ".model", | |
| "load_hamer_checkpoint": ".checkpoint", | |
| } | |
| __all__ = [ | |
| "HamerModel", | |
| "HandPrediction", | |
| "open_device", | |
| "load_reference", | |
| "apply_served_config", | |
| *_LAZY, | |
| ] | |
| def __getattr__(name: str) -> Any: | |
| mod = _LAZY.get(name) | |
| if mod is None: | |
| raise AttributeError(f"module 'hamer' has no attribute {name!r}") | |
| value = getattr(importlib.import_module(mod, __name__), name) | |
| globals()[name] = value | |
| return value | |
| def __dir__(): | |
| return sorted(set(globals()) | set(_LAZY)) | |