Code for the article about speed comparison of MLX and PyTorch on Apple's M1 MAX GPU: https://medium.com/@koypish/mps-or-mlx-for-domestic-ai-the-answer-will-surprise-you-df4b111de8a0
pyenv install 3.11pyenv local 3.111st option:
poetry shell2nd option:
python -m venv .venv; source .venv/bin/activatepip install -r requirements.txtmake mlxmake mps - for PyTorch on Metal GPUmake cpu - for PyTorch on CPUIn order to track CPU/GPU usage, keep make track running while performing operation of interest.




utils.py contains memory measurement utilstry_phi2_torch.ipynb, try_phi2_mlx.ipynb - benchmarks codephi2_mlx.py - code mainly copied from https://github.com/ml-explore/mlx-examples/tree/main/llms/phi2plot_metrics.ipynb - contains code to parse and analyze output of powermetrics (run by make track)17 commits
Jupyter Notebook
89.7%
Python
9.6%
Code for the article about speed comparison of MLX and PyTorch on Apple's M1 MAX GPU: https://medium.com/@koypish/mps-or-mlx-for-domestic-ai-the-answer-will-surprise-you-df4b111de8a0
pyenv install 3.11pyenv local 3.111st option:
poetry shell2nd option:
python -m venv .venv; source .venv/bin/activatepip install -r requirements.txtmake mlxmake mps - for PyTorch on Metal GPUmake cpu - for PyTorch on CPUIn order to track CPU/GPU usage, keep make track running while performing operation of interest.




utils.py contains memory measurement utilstry_phi2_torch.ipynb, try_phi2_mlx.ipynb - benchmarks codephi2_mlx.py - code mainly copied from https://github.com/ml-explore/mlx-examples/tree/main/llms/phi2plot_metrics.ipynb - contains code to parse and analyze output of powermetrics (run by make track)17 commits
Jupyter Notebook
89.7%
Python
9.6%