huggingface/swift-coreml-transformers
On-device Core ML implementations of GPT-2 and BERT for text generation and question answering on iOS/macOS.

Velocity · 7d
+0.7
★ / day
Trend
→steady
star history
This repository provides Swift Core ML implementations of popular transformer models including GPT-2, DistilGPT-2, BERT, and DistilBERT. It includes conversion scripts to export PyTorch models to Core ML format, custom Swift tokenizers (BERT tokenizer, GPT-2 BPE encoder), decoding strategies for text generation, and demo apps showcasing on-device inference. The models run entirely on Apple devices without server communication.