Skip to content

Commit e6d8796

Browse files
davidkoskiawni
andauthored
update README and examples (#232)
* update README and examples * Apply suggestions from code review Co-authored-by: Awni Hannun <awni@apple.com> --------- Co-authored-by: Awni Hannun <awni@apple.com>
1 parent a8f7411 commit e6d8796

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MLX Swift
22

3-
[**Installation**](#installation) | [**Documentation**](https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx) | [**Examples**](https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx/examples)
3+
[**Installation**](#installation) | [**Documentation**](https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx) | [**Examples**](#examples)
44

55
MLX Swift is a Swift API for [MLX](https://ml-explore.github.io/mlx/build/html/index.html).
66

@@ -10,16 +10,31 @@ on Apple silicon.
1010

1111
## Examples
1212

13-
MLX Swift has a [few
13+
MLX Swift has [many
1414
examples](https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx/examples),
1515
including:
1616

17-
- Large-scale text generation with Mistral 7B
18-
- Training a simple LeNet on MNIST
19-
- Examples that run on macOS or iOS
17+
- [MNISTTrainer](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/MNISTTrainer/README.md): An example that runs on
18+
both iOS and macOS that downloads MNIST training data and trains a
19+
[LeNet](https://en.wikipedia.org/wiki/LeNet).
20+
21+
- [MLXChatExample](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/MLXChatExample/README.md): An example chat app that runs on both iOS and macOS that supports LLMs and VLMs.
22+
23+
- [LLMEval](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/LLMEval/README.md): A simple example that runs on both iOS
24+
and macOS that downloads an LLM and tokenizer from Hugging Face and
25+
generates text from a given prompt.
26+
27+
- [StableDiffusionExample](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/StableDiffusionExample/README.md): An
28+
example that runs on both iOS and macOS that downloads a stable diffusion model
29+
from Hugging Face and generates an image from a given prompt.
30+
31+
- [llm-tool](https://github.com/ml-explore/mlx-swift-examples/blob/main/Tools/llm-tool/README.md): A command line tool for generating text
32+
using a variety of LLMs available on the Hugging Face hub.
2033

2134
The [MLX Swift Examples repo](https://github.com/ml-explore/mlx-swift-examples)
22-
contains the complete code and documentation for these examples.
35+
contains the complete code and documentation for these examples, including
36+
[guidelines on porting models](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxlmcommon/porting)
37+
from MLX Python.
2338

2439
## Installation
2540

@@ -46,10 +61,8 @@ and add the libraries as dependencies:
4661

4762
```swift
4863
dependencies: [.product(name: "MLX", package: "mlx-swift"),
49-
.product(name: "MLXRandom", package: "mlx-swift"),
5064
.product(name: "MLXNN", package: "mlx-swift"),
51-
.product(name: "MLXOptimizers", package: "mlx-swift"),
52-
.product(name: "MLXFFT", package: "mlx-swift")]
65+
.product(name: "MLXOptimizers", package: "mlx-swift")]
5366
```
5467

5568
> [!Note]
@@ -109,7 +122,6 @@ Ronan Collobert.
109122

110123
## Versions
111124

112-
The ``MLX`` array functions should match MLX as of tag
113-
[v0.3.0](https://github.com/ml-explore/mlx/releases/tag/v0.3.0). The `MLXNN`
114-
package should match MLX (`mlx.nn`) as of tag
115-
[v0.0.10](https://github.com/ml-explore/mlx/releases/tag/v0.0.10).
125+
See [Releases](https://github.com/ml-explore/mlx-swift/releases). Generally the MLX Swift version number corresponds to the same version number in [MLX](https://github.com/ml-explore/mlx). Release notes indicate specifics.
126+
127+
All capabilities in MLX (Python) should be available in MLX Swift. If you encounter any that are missing please file an issue or feel free to submit a PR.

Source/MLX/Documentation.docc/examples.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@ Examples using ``MLX`` and `MLXNN` are available on
1515
[GitHub](https://github.com/ml-explore/mlx-swift-examples). The examples
1616
include:
1717

18-
- [MNISTTrainer](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/MNISTTrainer/README.md):
19-
An example that runs on both iOS and macOS that downloads MNIST training data
20-
and trains a [LeNet](https://en.wikipedia.org/wiki/LeNet).
18+
- [MNISTTrainer](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/MNISTTrainer/README.md): An example that runs on
19+
both iOS and macOS that downloads MNIST training data and trains a
20+
[LeNet](https://en.wikipedia.org/wiki/LeNet).
2121

22-
- [LLMEval](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/LLMEval/README.md):
23-
An example that runs on both iOS and macOS that downloads an LLM and
24-
tokenizer from Hugging Face and and generates text from a given prompt.
22+
- [MLXChatExample](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/MLXChatExample/README.md): An example chat app that runs on both iOS and macOS that supports LLMs and VLMs.
2523

26-
- [LinearModelTraining](https://github.com/ml-explore/mlx-swift-examples/blob/main/Tools/LinearModelTraining/README.md):
27-
An example that trains a simple linear model.
24+
- [LLMEval](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/LLMEval/README.md): A simple example that runs on both iOS
25+
and macOS that downloads an LLM and tokenizer from Hugging Face and
26+
generates text from a given prompt.
2827

29-
- [llm-tool](https://github.com/ml-explore/mlx-swift-examples/blob/main/Tools/llm-tool/README.md):
30-
A command line tool for generating text using a variety of LLMs available on
31-
the Hugging Face hub.
28+
- [StableDiffusionExample](https://github.com/ml-explore/mlx-swift-examples/blob/main/Applications/StableDiffusionExample/README.md): An
29+
example that runs on both iOS and macOS that downloads a stable diffusion model
30+
from Hugging Face and generates an image from a given prompt.
3231

33-
- [mnist-tool](https://github.com/ml-explore/mlx-swift-examples/blob/main/Tools/mnist-tool/README.md):
34-
A command line tool for training a LeNet on MNIST.
32+
- [llm-tool](https://github.com/ml-explore/mlx-swift-examples/blob/main/Tools/llm-tool/README.md): A command line tool for generating text
33+
using a variety of LLMs available on the Hugging Face hub.
34+
35+
and several more. Much of the code is also available as a SwiftPM package -- use this as a starting point to build your own applications.

0 commit comments

Comments
 (0)