# huggingface/swift-transformers

Swift Package to implement a transformers-like API in Swift

Repository: https://github.com/huggingface/swift-transformers
Canonical: https://ross.abutalabs.com/products/swift-transformers
Language: Swift
License: Apache-2.0
License Family: permissive
Last push: 2026-08-24T15:12:07+00:00

## Health v2 (maintenance only)
Score: 91/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 84, longevity 86
- inputs: {"age_days": 1210, "days_push": 9, "days_rel": 109, "gap_med": 7.0, "n_releases_24m": 17}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1350, forks 205 (observed 2026-08-28T04:04:28.064984+00:00)

## What it is
A Swift Package providing a transformers-like API for Swift apps, including fast tokenization, chat templating, and reliable model downloads from the Hugging Face Hub. It enables developers to adopt language models in Swift applications with an API familiar to users of the Python transformers library.

## Use cases
- tokenize text for LLMs in a Swift app
- apply chat templates to messages on iOS
- download models from the Hugging Face Hub to a device
- format prompts for tool calling in Swift
- decode model tokens back to text
- build on-device ML features in Apple apps

## When to choose
- you are building Swift/iOS/macOS apps that use language models
- you need Python-transformers-style tokenization in Swift
- you want fast, reliable Hub model downloads on-device
- you need chat template and tool-calling support in Swift

## When to avoid
- you are working in Python or another non-Swift ecosystem
- you need to train or fine-tune models rather than prepare inputs
- you need full model inference beyond tokenization and hub utilities

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, nlp, sdk, http-client
- domain: machine-learning, large-language-models, developer-tools
- platform: cross-platform
- tags: tokenizers, huggingface-hub, chat-templates, swift-package, on-device-ml, tool-calling, natural-language-processing, swift, ios, macos

## Member repositories
- huggingface/swift-transformers (main) score 91

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:28.064984+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:42:17.210394+00:00, confidence not recorded.
  - readme: https://github.com/huggingface/swift-transformers (fetched 2026-08-28T04:04:28.064984+00:00, sha 175666b414c5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
