Swift Core ML implementations of Transformers

用于回答问题的 GPT-2、DistilGPT-2、BERT 和 DistilBERT 的 Swift Core ML 3 实现。其他 Transformers 即将推出!「Swift Core ML 3 implementations of GPT-2, DistilGPT-2, BERT, and DistilBERT for Question answering. Other Transformers coming soon!」

Github星跟蹤圖

This repo is not actively maintained and has been archived. For an in-development replacement, please head over to swift-transformers!

Swift Core ML implementations of Transformers: GPT-2, DistilGPT-2, BERT, DistilBERT, more coming soon!

This repository contains:

  • For BERT and DistilBERT:
    • pretrained Google BERT and Hugging Face DistilBERT models fine-tuned for Question answering on the SQuAD dataset.
    • Swift implementations of the BERT tokenizer (BasicTokenizer and WordpieceTokenizer) and SQuAD dataset parsing utilities.
    • A neat demo question answering app.
  • For GPT-2 and DistilGPT-2:
    • a conversion script from PyTorch trained GPT-2 models (see our transformers repo) to CoreML models.
    • The GPT-2 generation model itself, including decoding strategies (greedy and TopK are currently implemented) and GPT-2 Byte-pair encoder and decoder.
    • A neat demo app showcasing on-device text generation.

🦄 GPT-2 and DistilGPT-2

Unleash the full power of text generation with GPT-2 on device!!

demo

🐸 BERT and DistilBERT

The BERTSQUADFP16 Core ML model was packaged by Apple and is linked from the main ML models page. It was demoed at WWDC 2019 as part of the Core ML 3 launch.

The DistilBERT Core ML models were converted from 🤗/transformers exports using the scripts in this repo.

core ml 3

🦄 Demo Time 🔥

demo

Apple demo at WWDC 2019

wwdc demo

full video here

BERT Architecture (wwdc slide)

bert

Notes

We use git-lfs to store large model files and it is required to obtain some of the files the app needs to run.
See how to install git-lfson the installation page

主要指標

概覽
名稱與所有者huggingface/swift-coreml-transformers
主編程語言Swift
編程語言Swift (語言數: 2)
平台iOS, Mac
許可證Apache License 2.0
所有者活动
創建於2019-06-27 13:50:53
推送於2023-11-24 19:48:07
最后一次提交2023-11-24 20:48:06
發布數0
用户参与
星數1.7k
關注者數99
派生數179
提交數58
已啟用問題?
問題數28
打開的問題數20
拉請求數5
打開的拉請求數4
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?