Download inference.py from Aevanis/Aevanis-Vision-Core: direct link, hf CLI and curl.
- Browser
- Download file 800 Bytes
-
https://huggingface.co/Aevanis/Aevanis-Vision-Core/resolve/main/inference.py
- Command line
-
hf download hf://Aevanis/Aevanis-Vision-Core/inference.py
-
curl -L -o inference.py https://huggingface.co/Aevanis/Aevanis-Vision-Core/resolve/main/inference.py
800 Bytes
| import sys | |
| import torch | |
| from model import AevanisVisionBackbone | |
| if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8': | |
| try: | |
| sys.stdout.reconfigure(encoding='utf-8') | |
| except Exception: | |
| pass | |
| # 1. Load Pre-Trained Weights | |
| model = AevanisVisionBackbone.from_pretrained("pytorch_model.bin", model_scale="core") | |
| model.eval() | |
| # 2. Single 224x224 RGB Image Input | |
| dummy_input = torch.randn(1, 3, 224, 224) | |
| # 3. Extract Representations | |
| with torch.no_grad(): | |
| features = model(dummy_input) | |
| print("[INFO] CLS Token Embedding :", features["cls_token"].shape) # [1, 384] | |
| print("[INFO] Spatial 14x14 Grid :", features["spatial_tokens"].shape) # [1, 196, 384] | |
| print("[SUCCESS] Aevanis Vision Core Backbone inference completed without error.") | |