Skip to content

Commit fb9fce2

Browse files
FL33TW00Dmattt
andauthored
fix: modernize readme (#258)
* fix: modernize readme * Update README.md Co-authored-by: Mattt <mattt@me.com> * Update README.md Co-authored-by: Mattt <mattt@me.com> --------- Co-authored-by: FL33TW00D <FL33TW00D@users.noreply.github.com> Co-authored-by: Mattt <mattt@me.com>
1 parent 1c2c13e commit fb9fce2

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

README.md

Lines changed: 9 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 yet 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,17 @@ func testTokenizer() async throws {
3334
let decoded = tokenizer.decode(tokens: encoded)
3435
}
3536
```
37+
- `Hub`: Utilities for interacting with the Hugging Face Hub. Download models, tokenizers and other config files.
38+
39+
Usage example:
3640

37-
- `Hub`: Utilities for interacting with the Hugging Face Hub! Download models, tokenizers and other config files. Usage example:
3841
```swift
3942
import Hub
4043
func testHub() async throws {
4144
let repo = Hub.Repo(id: "mlx-community/Qwen2.5-0.5B-Instruct-2bit-mlx")
42-
let filesToDownload = ["config.json", "*.safetensors"]
4345
let modelDirectory: URL = try await Hub.snapshot(
4446
from: repo,
45-
matching: filesToDownload,
47+
matching: ["config.json", "*.safetensors"],
4648
progressHandler: { progress in
4749
print("Download progress: \(progress.fractionCompleted * 100)%")
4850
}
@@ -51,10 +53,9 @@ func testHub() async throws {
5153
}
5254
```
5355

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

57-
5859
## Usage via SwiftPM
5960

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

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

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-
10289
## Other Tools
10390

10491
- [`swift-chat`](https://github.com/huggingface/swift-chat), a simple app demonstrating how to use this package.
10592
- [`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`.
10793

10894
## Contributing
10995

0 commit comments

Comments
 (0)