[ Video ] How To Set Up Local AI on a 16GB MacBook

[Video] How To Set Up Local AI on a 16GB MacBook

[视频] 如何在 16GB 内存的 MacBook 上部署本地 AI

One of my YouTube subscribers asked, in a comment, how to set up a 16GB M1 MacBook Pro so it runs models in a more comfortable way, not necessarily in the terminal. This came as a reaction to my local models demo videos, which seem to be picking up lately. People enjoy that content, but they want something more visual to play with them. So, I made a new video, specifically for this. Just watch it above, if you’re the visual type. If not, read on for a detailed breakdown on how it’s done.

一位 YouTube 订阅者在评论中询问,如何配置 16GB 内存的 M1 MacBook Pro,以便更舒适地运行模型,而不必局限于终端操作。这是对我近期发布的本地模型演示视频的反馈,这些视频最近似乎很受欢迎。大家喜欢这类内容,但希望能有更直观的交互方式。因此,我专门制作了一个新视频。如果你喜欢视觉化内容,可以直接观看上方的视频;如果不是,请继续阅读下文,了解详细的操作步骤。

Setting Up The Local AI Foundation on a MacBook

在 MacBook 上搭建本地 AI 基础

The basic understanding of running local AI is that you first have to “serve” the model, and that is done usually in the terminal. After this step, you can start “consuming” the model, via a web interface, or even a desktop app. Serving the model is done, on a mac, with an utility called mlx-serve. It’s a solid command line utility, with a lot of arguments, which sometimes may be overwhelming. But the TLDR here is that you only need to remember 2 commands: mlx-serve run and mlx-serve serve.

运行本地 AI 的基本逻辑是:首先必须“部署(serve)”模型,这通常在终端中完成。完成此步骤后,你就可以通过 Web 界面甚至桌面应用程序来“调用(consume)”模型。在 Mac 上,部署模型是通过一个名为 mlx-serve 的工具完成的。这是一个功能强大的命令行工具,拥有许多参数,有时可能会让人感到眼花缭乱。但简单来说,你只需要记住两个命令:mlx-serve run 和 mlx-serve serve。

Depending on whether or not a model is already local, it also downloads the model on your machine. We are not using ollama or other more established binaries because mlx is specifically optimized for the Metal architecture of your Mac. Simply put, the models will run faster and with less resources. Serving the model is already 50% of the job. From there on, I explore 3 ways to consume this.

根据模型是否已存在于本地,该工具还会自动将模型下载到你的机器上。我们没有使用 Ollama 或其他更成熟的二进制程序,因为 MLX 是专门针对 Mac 的 Metal 架构进行优化的。简单来说,模型运行速度更快,且资源占用更少。部署模型已经完成了工作的一半,接下来我将探讨三种调用模型的方法。

Using Local AI With Grok Build

使用 Grok Build 运行本地 AI

Grok Build is my default CLI these days – I’m vintage, I know, and I spend 90% of my time in the terminal. I already talked about how to set up free models (both local and remote, on OpenRouter) on this post. The video is just a very short version of that. The TLDR is that you will edit Grok’s config.toml by adding the model characteristics, and then you’re just picking the model mid-session with /models inside Grok Build. It’s not complicated, if you like staying the terminal, and, like I said, that’s my goto approach when using AI in general.

Grok Build 是我目前默认使用的命令行界面(CLI)——我知道这很复古,我 90% 的时间都花在终端里。我之前已经在文章中介绍过如何设置免费模型(包括本地模型和 OpenRouter 上的远程模型)。视频只是其中的简短版本。简单来说,你需要编辑 Grok 的 config.toml 文件,添加模型特性,然后在 Grok Build 会话中使用 /models 命令选择模型。如果你喜欢在终端操作,这并不复杂,正如我所说,这是我使用 AI 时的首选方案。

Using Local AI With OpenWeb UI

使用 OpenWeb UI 运行本地 AI

OpenWeb UI is a chat wrapper on top of the local model, but it offers a relatively rich experience. It’s very simple to install, and it will offers you a familiar, ChatGPT style interface. You can switch models or adjust the model parameters, and generally do whatever you do with a standard ChatGPT interface, only it uses a local model. Use it if you’re spending most of the time in the browser.

OpenWeb UI 是本地模型之上的聊天外壳,但它提供了相对丰富的使用体验。它安装非常简单,并为你提供了一个熟悉的、类似 ChatGPT 的界面。你可以切换模型、调整参数,基本上可以像使用标准 ChatGPT 界面一样进行操作,唯一的区别是它运行的是本地模型。如果你大部分时间都在浏览器中工作,建议使用它。

Using Local AI With MLX-Serve (the desktop app)

使用 MLX-Serve(桌面应用)运行本地 AI

The most complex and rich experience comes from MLX-Serve, which is a notarized by Apple app, built on top of the command line utility mentioned at the beginning of this article. It is by far the nicest, most elegant way to run local AI on your machine and it has all the pre-requisites to become a more established app for day to day AI tasks. On top of the chat experience, you also get to generate images, voice (text to speech), music and even videos. There’s solid support for defining agents too, and you get recurring tasks as well. That’s my recommendation for anyone who want to try local AI on a Mac.

最复杂且功能最丰富的体验来自 MLX-Serve,这是一个经过 Apple 公证的应用程序,构建于本文开头提到的命令行工具之上。它是目前在机器上运行本地 AI 最美观、最优雅的方式,并且具备了成为日常 AI 任务主流应用的所有先决条件。除了聊天体验外,你还可以生成图像、语音(文本转语音)、音乐甚至视频。它对定义智能体(Agents)也有很好的支持,并且可以处理循环任务。对于任何想在 Mac 上尝试本地 AI 的人,我强烈推荐这款应用。

All the links for the above programs are in the video, feel free to check it out. As usual, if you like this kind of content, like, share and subscribe to my YouTube channel, you will help local AI grow.

上述所有程序的链接都在视频中,欢迎查看。一如既往,如果你喜欢这类内容,请点赞、分享并订阅我的 YouTube 频道,这将有助于本地 AI 的发展。