Download example.py from ZACK777/hi-mapper: direct link, hf CLI and curl.
- Browser
- Download file 355 Bytes
-
https://huggingface.co/ZACK777/hi-mapper/resolve/main/example.py
- Command line
-
hf download hf://ZACK777/hi-mapper/example.py
-
curl -L -o example.py https://huggingface.co/ZACK777/hi-mapper/resolve/main/example.py
355 Bytes
| """Minimal smoke test for HI-Mapper (no weights).""" | |
| import torch | |
| from hi_mapper import DivHiMapper | |
| B, D = 2, 768 | |
| mapper = DivHiMapper(feat_dim=D, curvature=0.2, target_radius=1.0) | |
| root, mid, leaves, hier_loss, prompt_loss, attr_loss = mapper( | |
| torch.randn(B, 5, D), torch.randn(B, D) | |
| ) | |
| print("root", tuple(root.shape), "hier_loss", float(hier_loss)) | |