1 篇文章带有标签 “t5”

MLX: An array framework for Apple silicon

MLX

统一内存:与 MLX 和其他框架的显着区别是统一内存模型。 MLX 中的数组位于共享内存中。 MLX 阵列上的操作可以在任何支持的设备类型上执行,而无需传输数据。

MLX Documentation

创建虚拟环境

mkdir ml-explore && cd ml-explore
git clone https://github.com/ml-explore/mlx
git clone https://github.com/ml-explore/mlx-examples

python -m venv env
source env/bin/activate

Phi-2

  • 安装依赖包
cd llms/phi2
pip install -r requirements.txt
  • 模型下载和转换

使用已经下载的模型

mkdir microsoft
ln -s /Users/junjian/HuggingFace/microsoft/phi-2 microsoft/phi-2

转换模型

python convert.py

这将生成 MLX 可以读取的 weights.npz 文件。

-rw-r--r--  1 junjian  staff   5.2G 12 20 20:36 weights.npz
  • 运行