Apple's big move: open-source ML framework for M-series chips, capable of running models as large as 7 billion parameters.

CN
巴比特
Follow
1 year ago

Source: Quantum Bit

Image Source: Generated by Wujie AI

Apple's M-series chip exclusive machine learning framework is now open source and gaining popularity!

Now, with this framework, you can directly run large models with 7 billion parameters on Apple's GPU, train Transformer models, or perform LoRA fine-tuning.

It was officially released by Apple and has a style similar to PyTorch, but it is not based on any existing framework.

Renowned figures like LeCun have come to praise and share.

Jim Fan, a senior AI scientist at NVIDIA, exclaimed:

This should be Apple's biggest move in open source AI so far.

Even netizens are considering the idea of using the A chip on their iPhones (hand-dog head).

So, what does this framework look like?

Reference to the design of multiple ML frameworks

This new framework is called MLX, which means exploring machine learning (ml-explore).

In terms of functionality, MLX mainly has the following characteristics:

Familiar API (including C++ API, Python API similar to NumPy, and some advanced function packages similar to PyTorch API), composable function transformations, lazy computation, dynamic graph construction, multi-device availability, unified memory.

Awni Hannun, the framework's author, explained that the reason MLX is not directly based on PyTorch is mainly due to several considerations.

Firstly, MLX framework is designed for Apple chips.

Apple chips have adopted some unique designs, such as unified memory, which can be utilized in the framework.

Furthermore, the MLX framework also draws on the strengths of different machine learning frameworks, including NumPy, PyTorch, Jax, and ArrayFire.

For example, the composable function transformations in JAX have been incorporated into the design of MLX, but the graph is still dynamically constructed.

In addition, the author believes that MLX also has some of its own characteristics, such as simplicity, flexibility, and diversity.

Therefore, in terms of functionality and design, MLX is not exactly the same as classic frameworks like PyTorch and has some "unique style".

If you have an Apple M-series chip computer, you can now try running AI models.

Exclusive to Apple computer M-series chips

Currently, the official has provided 5 reference cases for using MLX:

  • Training of Transformer architecture language models
  • Long text generation using LLaMA or Mistral
  • Parameter fine-tuning using LoRA
  • Image generation using Stable Diffusion
  • Speech recognition using Whisper

The authors have also released performance comparisons of PyTorch and MLX based on Stable Diffusion on GitHub:

If you are interested in these AI models, you can directly try them out after installing MLX.

The authors have provided a series of step-by-step tutorials on how to run the MLX framework on Apple computers.

First, pip install mlx to install the framework:

We also tried installing it on an Apple M-series chip computer and it was successful:

It is worth mentioning that before installing, make sure to check if your Apple computer, various environments, and operating systems are all set up properly.

And the chip must be Apple's self-developed M-series chip. You can use this command to check:

If it is an Intel platform, MLX cannot be used:

Once everything is set up, git clone a copy, and you can find the model you want to play with in the examples and try running it:

Here, let's try running LLaMA:

Then you can start asking questions, such as what is the Bolzano-Weierstrass theorem, and LLaMA can answer you in the terminal:

Sebastian Raschka from LightningAI said that this framework looks very cool, and he hopes to see more performance comparisons between PyTorch and MLX on macOS.

In addition, the implementation details of LLaMA on MLX are also very interesting:

Many Apple users are also expressing their joy: in the scarcity of H100, they can finally use M3 Max to get things done.

Have you tried MLX? How does it feel?

Reference links:
[1] https://github.com/ml-explore/mlx
[2] https://twitter.com/awnihannun/status/1732184443451019431

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

Share To
APP

X

Telegram

Facebook

Reddit

CopyLink