Image classification on the Apple Neural Engine (via ANEForge)
ANEForge
runs computation on the Apple Neural
Engine (ANE) directly, without CoreML.
load_vit
loads a Hugging Face Vision Transformer
image classifier (
ViTForImageClassification
) from the Hub by repo id and runs the whole
forward pass on the engine.
This is a usage card, not a re-hosted model: it points at the upstream weights and shows how
to run them on the ANE.
Install
pip install aneforge
Apple Silicon, macOS 14+.
Use
from aneforge.models import load_vit
from PIL import Image
vit = load_vit("google/vit-base-patch16-224") # any HF ViT image classifier
image = Image.open("cat.jpg")
print(vit.classify(image, top_k=5)) # [(label, logit), ...]; forward on the ANE# vit(image) -> raw logits [1, num_labels]
Measured
On an M5 Pro,
google/vit-base-patch16-224
runs the full forward in
~27 ms/image
, matching
the Hugging Face reference (same top-1, relerr 4e-3). Preprocessing uses the model's own
AutoImageProcessor
.
Scope
ViT-family classifiers with a CLS token and a pre-norm encoder (
ViTForImageClassification
and
compatible DeiT/BEiT-style models); both the modern and legacy HF weight namings are handled.
ResNet / ConvNeXt loaders are tracked as follow-up issues in the repo.
Why the ANE
The ANE is the fixed-function accelerator on every recent Apple device. In production it is
reachable only through CoreML, which can silently fall back to CPU/GPU; ANEForge compiles the
classifier to a single ANE program and dispatches it through the same daemon and kernel-driver
stack Apple's own frameworks use.
vit-image-classification huggingface.co is an AI model on huggingface.co that provides vit-image-classification's model effect (), which can be used instantly with this aneforge vit-image-classification model. huggingface.co supports a free trial of the vit-image-classification model, and also provides paid use of the vit-image-classification. Support call vit-image-classification model through api, including Node.js, Python, http.
vit-image-classification huggingface.co is an online trial and call api platform, which integrates vit-image-classification's modeling effects, including api services, and provides a free online trial of vit-image-classification, you can try vit-image-classification online for free by clicking the link below.
aneforge vit-image-classification online free url in huggingface.co:
vit-image-classification is an open source model from GitHub that offers a free installation service, and any user can find vit-image-classification on GitHub to install. At the same time, huggingface.co provides the effect of vit-image-classification install, users can directly use vit-image-classification installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
vit-image-classification install url in huggingface.co: