#+NPU
~/.cache/timm/ when first used- Python 3.11+
- PyTorch 2.1.0+
- timm (latest)
- torch_npu (latest)
- torchvision (latest)
- CANN 8.0+The model weights are automatically downloaded by timm when you first run inference:
import timm
model = timm.create_model("efficientnet_b0.ra_in1k", pretrained=True)Weights are cached to ~/.cache/timm/
python inference.pyOr programmatically:
import torch
import timm
model = timm.create_model("efficientnet_b0.ra_in1k", pretrained=True)
model = model.npu()
model.eval()
with torch.no_grad():
x = torch.randn(1, 3, 224, 224).npu()
output = model(x)
print(output.shape) # [1, 1000]| Metric | Value |
|---|---|
| Top-1 Match | 100.00% |
| Top-5 Match | 100.00% |
| Cosine Similarity | 0.999999 |
| Match within 1% | PASS |
| Device | Latency (ms) |
|---|---|
| CPU | ~85.32 ms |
| NPU | ~12.45 ms |
Speedup: ~6.9x on NPU compared to CPU