Skip to content

Commit 7376540

Browse files
committed
Update readme
1 parent f86b5ad commit 7376540

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This repository contains benchmarks for comparing two popular artificial
44
intelligence frameworks that work on Apple Silicon devices: MLX and PyTorch.
55

66
The idea behind this simple project is to enable a wise choice when starting an
7-
AI project in an Apple computer.
7+
AI project on an Apple computer.
88

99
We ran five benchmarks several times to emulate a day-to-day usage. For more information about
1010
them, please refer to section [Details about each benchmark](#details-about-each-benchmark).
@@ -127,7 +127,7 @@ cd mlx_models
127127

128128
Every Python file in the root folder represents a different benchmark. All of them require two arguments: the number
129129
of times to run the benchmark and the framework. If you'd like to run, for example, the TinyLLama inference benchmark
130-
ten times using PyTorch, run:
130+
ten times using PyTorch, execute:
131131

132132
```
133133
python3 llm_inference.py --framework pytorch --iter 10
@@ -154,13 +154,14 @@ the model size, epochs and other hyperparameters, refer to [lm_train.py](lm_trai
154154

155155
### Training/fine-tuning BERT
156156

157-
This is the [BERT-tiny model](https://huggingface.co/prajjwal1/bert-tiny) adapted to classify pairs of sentences as
158-
having a contradiction, entailment or neutral relation. The model is exactly the one presented in
159-
[Conneau et al](https://arxiv.org/pdf/1705.02364). It was implemented in pure PyTorch and pure MLX respectively.
157+
We utilized the model presented in [Conneau et al](https://arxiv.org/pdf/1705.02364), using the
158+
[BERT-tiny model](https://huggingface.co/prajjwal1/bert-tiny) for the respective BERT blocks. It classifies pairs of
159+
sentences as having a contradiction, entailment or neutral relation. It was implemented in pure PyTorch and pure
160+
MLX respectively. We do not initialize it with any pre-trained weights, so the benchmark can be seen as pure training.
160161

161162
The only adaptation in this case was that we used PyTorch dataloader for the MLX model too, as it was compatible with
162163
the tokenizer library. Even though the data loader creates a PyTorch tensor for each input, we can transform it to a
163-
numpy array without extra copies, so this setting did not harm the MLX setting.
164+
numpy array without extra copies, so this setting did not harm the MLX results.
164165

165166
### Whisper inference
166167

@@ -183,11 +184,11 @@ to account for the proper prompt formatting and execution constraints.
183184
### CPU/GPU switch
184185

185186
In this benchmark, we perform matrix multiplications in a loop. First, we multiply matrices in the CPU, then we
186-
multiply the results in the GPU. Lastly, we reuse the results from the latter as the input for the next iteration's
187-
CPU multiplication.
187+
multiply the resulting matrices in the GPU. Lastly, we reuse the results from the latter as the input
188+
for the next iteration's CPU multiplication.
188189

189-
The idea behind this benchmark is to assess how effective are each framework's mechanisms to move data (or just switch
190-
processor in the case of MLX) between execution units.
190+
The idea behind this benchmark is to assess how effective each framework's mechanisms are to move data between
191+
execution units.
191192

192193

193194

0 commit comments

Comments
 (0)