ANEForge: Python for direct computation on the Apple Neural Engine
Paper โข 2606.17090 โข Published โข 3
Run aneforge/gpt2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/aneforge/gpt2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/aneforge/gpt2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to evaluate https://huggingface.co/aneforge/gpt2. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to create a 4-bit version of https://huggingface.co/aneforge/gpt2. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
How to use aneforge/gpt2 with ANEForge:
# Run this model on the Apple Neural Engine, without CoreML.
import aneforge as af
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("aneforge/gpt2")
model = af.load_llm("aneforge/gpt2") # prefill + resident-KV-cache decode on the ANE
ids = tok.encode("The Neural Engine is")
print(tok.decode(model.generate(ids, max_new_tokens=20)))An unmodified duplicate of openai-community/gpt2, tagged for use with
ANEForge so the weights load and run directly on the
Apple Neural Engine (no CoreML). Weights are byte-identical to the source; see the original repo for
the model details. Licensed mit from the source.
# pip install "aneforge[models]"
import aneforge as af
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("aneforge/gpt2")
model = af.load_llm("aneforge/gpt2") # prefill + resident-KV-cache decode on the ANE
ids = tok.encode("The Neural Engine is")
print(tok.decode(model.generate(ids, max_new_tokens=20)))
ANEForge compiles the model's graph into a single ANE program and streams the weights from this repo
via huggingface_hub. See the docs and the
paper.
Base model
openai-community/gpt2