Skip to content

Commit 3f76877

Browse files
committed
fix: modernize readme
1 parent c5de635 commit 3f76877

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

README.md

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414

1515
`swift-transformers` is a collection of utilities to help adopt language models in Swift apps.
1616

17-
It tries to follow the Python `transformers` API and abstractions whenever possible, but it also aims to provide an idiomatic Swift interface and does not assume prior familiarity with [`transformers`](https://github.com/huggingface/transformers) or [`tokenizers`](https://github.com/huggingface/tokenizers).
18-
17+
Those familiar with the [`transformers`](https://github.com/huggingface/transformers) python library will find a familiar but idiomatic Swift API.
1918

2019
## Rationale & Overview
2120

2221
Check out [our announcement post](https://huggingface.co/blog/swift-coreml-llm).
2322

2423
## Modules
2524

26-
- `Tokenizers`: Utilities to convert text to tokens and back, with support for Chat Templates and Tools. Follows the abstractions in [`tokenizers`](https://github.com/huggingface/tokenizers). Usage example:
25+
- `Tokenizers`: Utilities to convert text to tokens and back, with support for Chat Templates and Tools. Follows the abstractions in [`tokenizers`](https://github.com/huggingface/tokenizers).
26+
27+
Usage example:
2728
```swift
2829
import Tokenizers
2930
func testTokenizer() async throws {
@@ -33,16 +34,15 @@ func testTokenizer() async throws {
3334
let decoded = tokenizer.decode(tokens: encoded)
3435
}
3536
```
36-
3737
- `Hub`: Utilities for interacting with the Hugging Face Hub! Download models, tokenizers and other config files. Usage example:
38+
3839
```swift
3940
import Hub
4041
func testHub() async throws {
4142
let repo = Hub.Repo(id: "mlx-community/Qwen2.5-0.5B-Instruct-2bit-mlx")
42-
let filesToDownload = ["config.json", "*.safetensors"]
4343
let modelDirectory: URL = try await Hub.snapshot(
4444
from: repo,
45-
matching: filesToDownload,
45+
matching: ["config.json", "*.safetensors"],
4646
progressHandler: { progress in
4747
print("Download progress: \(progress.fractionCompleted * 100)%")
4848
}
@@ -51,10 +51,9 @@ func testHub() async throws {
5151
}
5252
```
5353

54-
- `Generation`: Algorithms for text generation. Handles tokenization internally. Currently supported ones are: greedy search, top-k sampling, and top-p sampling.
54+
- `Generation`: Utilities for text generation, handling tokenization for you. Currently supported sampling methods: greedy search, top-k sampling, and top-p sampling.
5555
- `Models`: Language model abstraction over a Core ML package.
5656

57-
5857
## Usage via SwiftPM
5958

6059
To use `swift-transformers` with SwiftPM, you can add this to your `Package.swift`:
@@ -85,25 +84,10 @@ targets: [
8584

8685
Using `swift-transformers` in your project? Let us know and we'll add you to the list!
8786

88-
## Supported Models
89-
90-
You can run inference on Core ML models with `swift-transformers`. Note that Core ML is not required to use the `Tokenizers` or `Hub` modules.
91-
92-
This package has been tested with autoregressive language models such as:
93-
94-
- GPT, GPT-Neox, GPT-J.
95-
- SantaCoder.
96-
- StarCoder.
97-
- Falcon.
98-
- Llama 2.
99-
100-
Encoder-decoder models such as T5 and Flan are currently _not supported_.
101-
10287
## Other Tools
10388

10489
- [`swift-chat`](https://github.com/huggingface/swift-chat), a simple app demonstrating how to use this package.
10590
- [`exporters`](https://github.com/huggingface/exporters), a Core ML conversion package for transformers models, based on Apple's [`coremltools`](https://github.com/apple/coremltools).
106-
- [`transformers-to-coreml`](https://huggingface.co/spaces/coreml-projects/transformers-to-coreml), a no-code Core ML conversion tool built on `exporters`.
10791

10892
## Contributing
10993

0 commit comments

Comments
 (0)