Skip to content

Commit 3b6f3e7

Browse files
FL33TW00Dpcuenca
andauthored
Feature/readme (#181)
* chore: update banner * chore: mini changes * Update README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> * Update README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> * Update README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> * Update README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> * Update README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> * Update README.md Co-authored-by: Pedro Cuenca <pedro@huggingface.co> --------- Co-authored-by: FL33TW00D <FL33TW00D@users.noreply.github.com> Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
1 parent a592e2c commit 3b6f3e7

File tree

2 files changed

+61
-16
lines changed

2 files changed

+61
-16
lines changed

README.md

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# `swift-transformers`
1+
<p align="center">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="media/swift-t-banner.png">
4+
<source media="(prefers-color-scheme: light)" srcset="media/swift-t-banner.png">
5+
<img alt="Swift + Transformers" src="media/swift-t-banner.png" style="max-width: 100%;">
6+
</picture>
7+
<br/>
8+
<br/>
9+
</p>
10+
11+
212
[![Unit Tests](https://github.com/huggingface/swift-transformers/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/huggingface/swift-transformers/actions/workflows/unit-tests.yml)
313
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fhuggingface%2Fswift-transformers%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/huggingface/swift-transformers)
414
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fhuggingface%2Fswift-transformers%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/huggingface/swift-transformers)
@@ -25,23 +35,26 @@ func testTokenizer() async throws {
2535
}
2636
```
2737

28-
You don't usually need to tokenize the input text yourself - the [`Generation` code](https://github.com/huggingface/swift-transformers/blob/17d4bfae3598482fc7ecf1a621aa77ab586d379a/Sources/Generation/Generation.swift#L82) will take care of it.
38+
- `Hub`: Utilities for interacting with the Hugging Face Hub! Download models, tokenizers and other config files. Usage example:
39+
```swift
40+
import Hub
41+
func testHub() async throws {
42+
let repo = Hub.Repo(id: "mlx-community/Qwen2.5-0.5B-Instruct-2bit-mlx")
43+
let filesToDownload = ["config.json", "*.safetensors"]
44+
let modelDirectory: URL = try await Hub.snapshot(
45+
from: repo,
46+
matching: filesToDownload,
47+
progressHandler: { progress in
48+
print("Download progress: \(progress.fractionCompleted * 100)%")
49+
}
50+
)
51+
print("Files downloaded to: \(modelDirectory.path)")
52+
}
53+
```
2954

30-
- `Hub`: Utilities to download config files from the Hub, used to instantiate tokenizers and learn about language model characteristics.
31-
- `Generation`: Algorithms for text generation. Currently supported ones are greedy search and top-k sampling.
55+
- `Generation`: Algorithms for text generation. Handles tokenization internally. Currently supported ones are: greedy search, top-k sampling, and top-p sampling.
3256
- `Models`: Language model abstraction over a Core ML package.
3357

34-
## Supported Models
35-
36-
This package has been tested with autoregressive language models such as:
37-
38-
- GPT, GPT-Neox, GPT-J.
39-
- SantaCoder.
40-
- StarCoder.
41-
- Falcon.
42-
- Llama 2.
43-
44-
Encoder-decoder models such as T5 and Flan are currently _not supported_. They are high up in our [priority list](#roadmap).
4558

4659
## Usage via SwiftPM
4760

@@ -55,7 +68,7 @@ dependencies: [
5568

5669
And then, add the Transformers library as a dependency to your target:
5770

58-
```
71+
```swift
5972
targets: [
6073
.target(
6174
name: "YourTargetName",
@@ -66,12 +79,44 @@ targets: [
6679
]
6780
```
6881

82+
## Projects that use swift-transformers ❤️
83+
84+
- [WhisperKit](https://github.com/argmaxinc/WhisperKit): A Swift Package for state-of-the-art speech-to-text systems from [Argmax](https://github.com/argmaxinc)
85+
- [MLX Swift Examples](https://github.com/ml-explore/mlx-swift-examples): A Swift Package for integrating MLX models in Swift apps.
86+
87+
Using `swift-transformers` in your project? Let us know and we'll add you to the list!
88+
89+
## Supported Models
90+
91+
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.
92+
93+
This package has been tested with autoregressive language models such as:
94+
95+
- GPT, GPT-Neox, GPT-J.
96+
- SantaCoder.
97+
- StarCoder.
98+
- Falcon.
99+
- Llama 2.
100+
101+
Encoder-decoder models such as T5 and Flan are currently _not supported_.
102+
69103
## Other Tools
70104

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

109+
## Contributing
110+
111+
Swift Transformers is a community project and we welcome contributions. Please
112+
check out [Issues](https://github.com/huggingface/swift-transformers/issues)
113+
tagged with `good first issue` if you are looking for a place to start!
114+
115+
Please ensure your code passes the build and test suite before submitting a pull
116+
request. You can run the tests with `swift test`.
117+
75118
## License
76119

77120
[Apache 2](LICENSE).
121+
122+

media/swift-t-banner.png

290 KB
Loading

0 commit comments

Comments
 (0)