{"id":13644183,"url":"https://github.com/huggingface/swift-coreml-transformers","last_synced_at":"2025-05-15T20:00:39.127Z","repository":{"id":46370245,"uuid":"194104216","full_name":"huggingface/swift-coreml-transformers","owner":"huggingface","description":"Swift Core ML 3 implementations of GPT-2, DistilGPT-2, BERT, and DistilBERT for Question answering. Other Transformers coming soon!","archived":false,"fork":false,"pushed_at":"2023-11-24T19:48:07.000Z","size":9659,"stargazers_count":1653,"open_issues_count":24,"forks_count":179,"subscribers_count":99,"default_branch":"master","last_synced_at":"2025-05-08T05:39:53.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huggingface.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-27T13:50:53.000Z","updated_at":"2025-05-05T03:26:33.000Z","dependencies_parsed_at":"2024-08-02T01:18:09.266Z","dependency_job_id":"f8b394c9-32f6-41c8-939e-e0afe4086e0e","html_url":"https://github.com/huggingface/swift-coreml-transformers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fswift-coreml-transformers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fswift-coreml-transformers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fswift-coreml-transformers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fswift-coreml-transformers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huggingface","download_url":"https://codeload.github.com/huggingface/swift-coreml-transformers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414455,"owners_count":22067262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:01:58.727Z","updated_at":"2025-05-15T20:00:38.669Z","avatar_url":"https://github.com/huggingface.png","language":"Swift","funding_links":[],"categories":["Reimplementations","Misc","Utilities","Swift"],"sub_categories":["Notes"],"readme":"# This repo is not actively maintained and has been archived. For an in-development replacement, please head over to [swift-transformers](https://github.com/huggingface/swift-transformers)!\n\n\n# Swift Core ML implementations of Transformers: GPT-2, DistilGPT-2, BERT, DistilBERT, more coming soon!\n\nThis repository contains:\n- For **BERT** and **DistilBERT**:\n\t- pretrained [Google BERT](https://github.com/google-research/bert) and [Hugging Face DistilBERT](https://arxiv.org/abs/1910.01108) models fine-tuned for Question answering on the SQuAD dataset.\n\t- Swift implementations of the [BERT tokenizer](https://github.com/huggingface/swift-coreml-transformers/blob/master/Sources/BertTokenizer.swift) (`BasicTokenizer` and `WordpieceTokenizer`) and SQuAD dataset parsing utilities.\n\t- A neat demo question answering app.\n- For **GPT-2** and **DistilGPT-2**:\n\t- a [conversion script](https://github.com/huggingface/swift-coreml-transformers/blob/master/model_generation/gpt2.py) from PyTorch trained GPT-2 models (see our [`transformers`](https://github.com/huggingface/transformers) repo) to CoreML models.\n\t- The [GPT-2 generation model](https://github.com/huggingface/swift-coreml-transformers/blob/master/Sources/GPT2.swift) itself, including decoding strategies (greedy and TopK are currently implemented) and GPT-2 Byte-pair encoder and decoder.\n\t- A neat demo app showcasing on-device text generation.\n\n\n# 🦄 GPT-2 and DistilGPT-2\n\nUnleash the full power of text generation with GPT-2 on device!!\n\n![demo](https://raw.githubusercontent.com/huggingface/swift-coreml-transformers/master/media/coreml-gpt2.gif)\n\n# 🐸 BERT and DistilBERT\n\nThe `BERTSQUADFP16` Core ML model was packaged by Apple and is linked from the [main ML models page](https://developer.apple.com/machine-learning/models/#text). It was demoed at WWDC 2019 as part of the Core ML 3 launch.\n\nThe `DistilBERT` Core ML models were converted from [`🤗/transformers`](https://github.com/huggingface/transformers) exports using the scripts in this repo.\n\n![core ml 3](https://raw.githubusercontent.com/huggingface/swift-coreml-transformers/master/media/coreml3-models-tweaked.png)\n\n## 🦄 Demo Time 🔥\n\n![demo](https://raw.githubusercontent.com/huggingface/swift-coreml-transformers/master/media/coreml-squad-small.gif)\n\nApple demo at WWDC 2019\n\n![wwdc demo](https://raw.githubusercontent.com/huggingface/swift-coreml-transformers/master/media/wwdc704.gif)\n\nfull video [here](https://developer.apple.com/videos/play/wwdc2019/704)\n\n## BERT Architecture (wwdc slide)\n\n![bert](https://raw.githubusercontent.com/huggingface/swift-coreml-transformers/master/media/bert-architecture.png)\n\n## Notes\n\nWe use `git-lfs` to store large model files and it is required to obtain some of the files the app needs to run.\nSee how to install `git-lfs`on the [installation page](https://git-lfs.github.com/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Fswift-coreml-transformers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuggingface%2Fswift-coreml-transformers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Fswift-coreml-transformers/lists"}