Download code/tt_depthpro2/__init__.py from changh95/DepthPro2: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/changh95/DepthPro2/resolve/main/code/tt_depthpro2/__init__.py
- Command line
-
hf download hf://changh95/DepthPro2/code/tt_depthpro2/__init__.py
-
curl -L -o __init__.py https://huggingface.co/changh95/DepthPro2/resolve/main/code/tt_depthpro2/__init__.py
1.92 kB
| # SPDX-License-Identifier: Apache-2.0 | |
| """DepthPro2: Apple's Depth Pro 2 (S, B, L, H+) monocular and video metric depth on one Tenstorrent Blackhole p150. | |
| from tt_depthpro2 import DepthPro2 | |
| with DepthPro2.from_pretrained("L") as model: | |
| out = model.infer("photo.jpg") # inverse depth, depth in metres, focal length in pixels | |
| Sub-packages / modules: ``api`` (the Python API), ``config`` (sizes, weights pins, resolution buckets, video | |
| settings), ``io`` (image decoding, array / PNG encoding), ``streaming`` (buffered / unbuffered video on the host), | |
| ``cpu_engine`` (the device-engine interface on the CPU reference), ``server`` (the HTTP server, client and smoke | |
| test), ``reference`` (clean-room float32 CPU reference, no Apple code), ``tt`` (the device programs), ``ttaw`` | |
| (vendored common helpers), ``tests``. Importing this package has no side effects (exports load lazily). | |
| The weights are Apple's (apple/DepthPro2-*, Apple Machine Learning Research Model License: research purposes only); | |
| they are not part of this package. Apple Machine Learning Research Model is licensed under the Apple Machine | |
| Learning Research Model License Agreement. | |
| """ | |
| __version__ = "0.2.0" | |
| __all__ = ["DepthPro2", "DepthOutput", "VideoSession", "load_sample", "InputError", "open_device", "close_device", | |
| "__version__"] | |
| _EXPORTS = { | |
| "DepthPro2": ("api", "DepthPro2"), | |
| "DepthOutput": ("api", "DepthOutput"), | |
| "VideoSession": ("api", "VideoSession"), | |
| "load_sample": ("api", "load_sample"), | |
| "InputError": ("io", "InputError"), | |
| "open_device": ("device", "open_device"), | |
| "close_device": ("device", "close_device"), | |
| } | |
| def __getattr__(name): | |
| if name in _EXPORTS: | |
| import importlib | |
| mod, attr = _EXPORTS[name] | |
| return getattr(importlib.import_module(f"{__name__}.{mod}"), attr) | |
| raise AttributeError(f"module {__name__!r} has no attribute {name!r}") | |