swift-transformers

Hugging Face's Swift package for tokenizers, model downloads and running models in Swift apps.

View on GitHub ↗
Stars
★ 1,360
Last commit
14 Oct 2026
Maintenance
Active
Licence
Apache-2.0
Category
On-device AI SDKs
GitHub
huggingface/swift-transformers

Overview

swift-transformers from Hugging Face is a set of utilities for using language models in Swift apps. Its API will feel familiar to users of the Python transformers library while staying idiomatic Swift. The most used parts are Tokenizers and Hub, for fast tokenisation and model downloads.

Features

  • Tokenisation and chat templating
  • Formats inputs for tool calling
  • Fast, reliable model downloads from the Hugging Face Hub
  • Utilities for working with Core ML models and generation
  • Offline tokenisers for bundled Core ML models
  • Optional Xet trait for fast parallel downloads

Requirements

The source doesn't list any requirements, so check the project's own docs before you install.

Install

  1. Add the package to Package.swift and add the Transformers product to your target

    .package(url: "https://github.com/huggingface/swift-transformers", from: "1.3.0")

Works with

Not stated by the source

Listed in

GitHub search

Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.

More in this category