推荐微信扫码登录以获得更好的体验!另:🎉建议更新到最新版,以体验新功能!🎉 版本更新记录→

【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南

3

剧集目录

标题时长
P1【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南 中24:26
P2【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南 英24:26
P3【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南 无24:27

P1 · 【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南 p01 中英字幕 (P1)

字幕摘录

时间英文中文
0:00Everybody is talking about running AI locally,大家都在谈论本地的人工智能
0:03but almost nobody explains what it is但几乎没人解释是什么
0:05or how you actually get it to work.或者你如何真正让它工作。
0:07Now you get these videos where people throw around terms现在,你得到这些视频 人们扔周围的条件
0:09如重量或量化、VRAM、GGUF、
0:13and it sounds like you need a PhD听起来你需要博士学位
0:15and a $10,000 computer just to try this out.和一万块的电脑 只是试试这个。
0:18And that's exactly why most people give up这就是为什么大多数人放弃
0:20and just keep paying for subscriptions like ChatGPT.继续支付像ChatGPT这样的订阅费.
0:23So let me give you the honest one sentence version here.所以,让我给你一个诚实的句子。
展开字幕全文(715 条)
序号英文中文
1Everybody is talking about running AI locally,大家都在谈论本地的人工智能
2but almost nobody explains what it is但几乎没人解释是什么
3or how you actually get it to work.或者你如何真正让它工作。
4Now you get these videos where people throw around terms现在,你得到这些视频 人们扔周围的条件
5如重量或量化、VRAM、GGUF、
6and it sounds like you need a PhD听起来你需要博士学位
7and a $10,000 computer just to try this out.和一万块的电脑 只是试试这个。
8And that's exactly why most people give up这就是为什么大多数人放弃
9and just keep paying for subscriptions like ChatGPT.继续支付像ChatGPT这样的订阅费.
10So let me give you the honest one sentence version here.所以,让我给你一个诚实的句子。
11That is that local AI is simply a model file这就是说本地的AI只是一个模型文件
12that's sitting on your computer and a program that runs it.坐在你的电脑和运行程序上
13That's it.就这样
14No cloud, no API keys, no internet, no subscription.没有云,没有API键,没有互联网,没有订阅.
15Everything else is really just a small detail.其他一切都只是个小细节
16So in this video, I'm gonna break down因此,在这个视频中,我要打破
17what's actually happening under the hood,引擎盖下到底发生了什么
18the real building blocks, and none of the fluff.真正的建筑构件, 和没有绒毛。
19And then I'm gonna show you how to run a model然后我会告诉你如何运行一个模型
20on your own machine in four completely different ways,在你自己的机器上 四种完全不同的方式,
21from an app that you download从您下载的应用程序中
22all the way to pure low-level code一直到纯低层代码
23where you're running it yourself.在那里你运行它自己。
24Now by the end of this video,现在,在这个视频结束时,
25you're gonna understand local AI你会明白本地的AI
26better than most people that are posting about it.比大多数贴报的人要好
27So let's dive in.所以让我们潜入。
28So first, let's clear up先说清楚
29the most common confusion that I see.我所看到的最常见的混乱
30Now that's what's actually different这才是真正的不同
31between something like ChatGPT and a local model.在像ChatGPT之类的东西 和本地模型之间
32Now when you use ChatGPT, Cloud, Gemini,当你使用ChatGPT,云,双子座,
33really any of these tools,任何这些工具,
34what's happening is that you type a message,发生的事情是 你输入一个消息,
35that message leaves your computer,留言留下你的电脑,
36it travels over the internet to something like a data center它在互联网上游历到一个像数据中心的东西
37where a massive computer that you don't own你没有的大型电脑
38runs a giant model,运行一个巨大的模型,
39and then the answer gets streamed back to your screen.然后答案被流回你的屏幕。
40So your computer did basically nothing.所以,你的电脑基本上什么都没做。
41It's really just a window into somebody else's machine.它真的只是一个窗口 进入别人的机器。
42Now local AI completely flips that.现在本地的AI完全推翻了这一点.
43The model, so the actual file模型,所以实际文件
44that contains all of the intelligence包含所有情报
45gets downloaded onto your computer.下载到电脑上
46And when you ask it a question,当你问这个问题时,
47your own CPU or GPU is the one that's doing the work.您的CPU或GPU是 做这项工作。
48So nothing leaves your machine,所以,没有什么离开你的机器,
49and that gives you three big advantages.这给你三个大优势
50Now first, it's private.现在,首先,这是私人的。
51That's because your data never goes anywhere,那是因为你的数据从不消失
52it stays on your computer.它留在你的电脑上。
53Second, it's free because there's no subscription第二,免费,因为没有订户
54and there's no per-token cost.而且没有每桶成本。
55And lastly, it works offline.最后,它的工作离线。
56So if you're in a plane or a coffee shop with terrible Wi-Fi,所以,如果你在飞机或咖啡店 用可怕的无线,
57doesn't matter, you can use these local models.无所谓,你可以使用这些本地模型。
58Now I do wanna be honest here about the trade-offs,现在,我想诚实地在这里 关于权衡,
59which is that the models that you're gonna be able也就是你能够做的模型
60to run at home are much smaller than the frontier models在家跑步比边疆模式要小得多
61that you'd use from something like Cloud or OpenAI.你会用在云或OpenAI之类的东西上
62But they have gone shockingly good但是,他们已经走了惊人的好
63over the last couple of years,在过去几年里,
64and for a huge amount of everyday tasks,和大量日常工作,
65even coding tasks, they're more than enough.甚至编码任务,它们都足够了。
66So with that said, let's have a look所以说,让我们来看看
67at the actual pieces here,在实际的作品在这里,
68so you understand local models much deeper.所以你更了解当地的模型
69Now the first part here is the model itself.现在第一部分是模型本身。
70And I wanna be really clear about what a model actually is,我想说清楚什么是模特儿
71because this is where some people imagine因为这就是一些人想象的
72some kind of magic black box.某种魔力黑盒。
73Now a model is literally just a file.现在一个模型其实只是一个文件。
74It's a really big file, could be hundreds of gigabytes,这是一个非常大的文件,可能是数百千兆字节,
75that's full of numbers that we call weights.我们称之为重量数
76Now these are billions of numbers这些是数十亿的数字
77that got baked in when the model was trained.当模特被训练时 被烤熟了
78Now that file doesn't think, it doesn't run,现在那个文件不思考,它不运行,
79it just sits there on your disk它只是坐在你的磁盘上
80like any other file that you would have.就像其他文件一样
81And companies like Meta, Google, Alibaba, Mistral, whatever,还有梅塔、谷歌、阿里巴巴、米斯特拉尔等公司
82they release these files for free.他们免费发布这些文件。
83Now those are your open models这些是你的公开模型
84and things that you keep hearing about和你们所听到的
85比如Llama或者Gemma或者Quen或者DeepSeq,你懂这个意思.
86You can literally just download them你可以直接下载
87because they are literally just a file因为从字面上来说,它们只是一个文件
88full of billions of different numbers.充满了数十亿个不同的数字。
89Now when you go to look at these models,当你去看这些模型时,
90you're gonna see names like four billion,你会看到40亿的名字,
91eight billion, 70 billion.八十亿七百亿.
92Now that B is billions,现在B是亿,
93and it stands for the number of parameters.它代表参数的数量。
94Now that's effectively just how many numbers现在,这是有效的 只是多少数字
95are inside of that file.里面的档案。
96And the rule here is pretty simple.这里的规则很简单。
97Generally speaking, more parameters means a smarter model,一般来说,更多的参数意味着一个更聪明的模型,
98but it also means a bigger file但它也意味着一个更大的文件
99that needs more memory and compute to run.这需要更多的记忆和计算运行。
100So if you look at an eight billion model,所以如果你看看80亿的模型
101this is maybe a few gigabytes in storage.这也许是几千兆字节的存储。
102Well, a 70 billion model is a file that's so large嗯,一个700亿的模型是一个文件 这是那么大
103that most laptops simply cannot even load it,大部分笔记本电脑都装不下
104and some may not even have enough storage to download it.而有些人甚至可能没有足够的存储器可以下载.
105Now that leads directly into the biggest trick现在,这直接 进入最大的诡计
106that happens with local AI.这发生在本地AI。
107Now this is something called quantization.这是所谓的量化。
108Now it sounds scary and really complicated,现在听起来很可怕,很复杂
109but it's really the same idea as compressing a photo.但它真的相同的想法 压缩一张照片。
110So you can take these billions of numbers这样你就可以拿这些亿万的数字
111and you can store them with less precision.并且可以更精确地储存它们。
112And that means that this model file这意味着这个模型文件
113is gonna get dramatically smaller就会变小
114with barely any quality loss at all.几乎没有质量损失。
115So a model that would normally need 16 gigabytes of memory所以这个模型通常需要16千兆字节的内存
116in its original form might only need five, six,原型可能只需要五,六,
117or seven gigabytes after quantization.或七千兆字节后
118And when you see the term gguf floating around,当你看到这个术语漂浮,
119that's basically just the standard file format这基本上只是标准文件格式
120for these compressed models.这些压缩模型。
121Now this is the entire reason that normal computers这才是正常电脑的原因
122can even run AI models at all,甚至可以运行AI模型,
123or at least some of the bigger ones.或至少一些较大的。
124So when you hear about quantization所以,当你听到关于量化
125or a quantized model,或被量化的模型,
126just think of that as a compressed model把这当成一个压缩模型
127that's meant to make it smaller so it's easier to run.意思是让它变小 所以它更容易运行。
128When you compress these models,当你压缩这些模型时,
129you keep almost the exact same performance,你保持几乎完全相同的表现,
130but again, you just reduce the size drastically,再说一次,你只是大大缩小了尺寸
131so it's a lot easier to actually run.因此,这很容易真正运行。
132Now the next piece is the inference engine.现在下一个是推论引擎。
133And this is the part that almost nobody explains.这是几乎没人解释的部分。
134Remember that the model is just a file full of numbers,记住,模型只是一个文件 充满数字,
135and a file can't run itself.并且文件不能自己运行。
136So you need a program所以你需要一个程序
137that can actually load these numbers into memory可以将这些数字装入内存
138and do the actual math to make the model work并做实际的数学 使模型工作
139and predict the next token.并预言下一个迹象。
140Now that program is called an inference engine.现在这个程序叫做推论引擎.
141Now the most famous one is called llama.cpp.现在最著名的一个叫做lama.cpp.
142And here's the secret,这是秘密
143almost every tool that I'm gonna show you today,几乎每一个工具 我今天要给你看,
144so LM Studio, Olamma, Docker Model Runner,因此LM工作室,奥拉姆马,多克模型运行器,
145they're all basically just a wrapper他们基本上都只是一个包装器
146around engines like this.绕着这种引擎
147Now the engine does all of the work,现在引擎完成了所有的工作,
148and the tool just kind of makes it nice to use,而工具只是 那种使它使用,
149which you're gonna see later on.稍后你会看到的。
150Now the last building block here is your hardware,最后一块是你们的硬件
151because there's really only one question因为只有一个问题
152that decides what local models决定何种地方模式
153you're going to be able to run.你会跑的
154Now that is, how much memory do you have on your computer,你电脑里有多少记忆
155and how fast is that memory?记忆有多快?
156Now on a PC with a graphics card,现在在一台带显卡的PC上
157so a dedicated graphics card,所以一个专用的显卡,
158that number is gonna be your VRAM.这个号码会是你的VRAM。
159So if you have an Nvidia 3090 or 4090 or 5090,所以,如果你有一个Nvidia 3090或4090或5090,
160or I'm just naming random GPUs,或者我只是命名随机GPU,
161you're gonna look at the VRAM on that device.你看看那个装置上的VRAM
162Now if you're running on a modern Mac computer,如果你在现代Mac电脑上运行
163就像M3或M4一样 任何M系列的MacBook
164then you're just gonna be looking at the amount of RAM那你就只能看看内存的数量
165that your computer has.你的电脑有。
166And that's because Apple shares its memory with the GPU,这是因为苹果公司与GPU共享其记忆,
167and has something called unified memory.并有所谓的统一记忆。
168Now other devices have different specifications,现在其他设备有不同的规格,
169but generally speaking,但总的来说,
170if you have a relatively new computer,如果你有一个相对新的计算机,
171if it has a dedicated graphics card,如果它有一个专用的图形卡,
172你看着VRAM。
173That's the amount of memory you're gonna have这就是你的记忆量
174for running local models.用于运行本地模型。
175And if you're on a Mac, again, a modern one,如果你在Mac上 又是现代的
176you're looking at the amount of unified memory.你在看统一记忆的量
177And the rule of thumb here is pretty simple.这里的拇指规则很简单。
178The model file needs to be able to fit模型文件需要适合
179inside of that memory that you have在你的记忆中
180with a little bit of room to spare.还有一点空位
181So roughly speaking,所以说,
182if you have eight gigabytes of VRAM or unified memory,如果你有8千兆字节 VRAM 或统一的内存,
183you're gonna be able to run three to four billion你会跑到三四十亿
184parameter models, even without being quantized.参数模型,即使没有被量化.
185And if you have 16 gigabytes of memory,如果你有16千兆字节的记忆
186you can go up to seven or eight billion parameter models.可以达到70或80亿个参数模型。
187And then if you go up to 32 gigabytes,然后如果你升到32千兆字节
188you start to be able to get into the 14你开始可以进入14
189to 30 billion parameter range.到300亿参数范围。
190And this is where things start to feel genuinely smart,而这就是事情开始 感觉真正聪明,
191especially for local models.特别是当地模特儿
192But keep in mind,但记住,
193you don't need a monster computer to do any of this.你不需要怪物电脑来做这些
194Even with something like your phone,即使是用你的手机一样的东西
195you can run small models already.你可以运行小模型了。
196And one thing that carries over from cloud AI还有从云中传来的一件事
197is that the context windows是上下文窗口
198to the model short-term working memory到模式短期工作记忆
199is going to actually affect the amount of space将会影响空间的大小
200that's being taken up.这正在处理中。
201So if you have long conversations, bigger documents, et cetera,所以,如果你有长话短说, 更大的文件等等,
202that's also going to fill up your memory.那也会让你的记忆充满
203Now I'm gonna explain this a little bit more in detail现在我要详细解释一下
204because this is super important.因为这很重要
205But the basic idea is that the one number但基本想法是,一个数字
206you need to be aware of is how much memory,你需要知道 有多少记忆,
207either VRAM or unified memory is on your computer.无论是VRAM还是统一的内存都在你的电脑上。
208When you look at a model, whether it's quantized or not,当你看一个模型, 无论它是否被量化,
209it needs to be able to fit comfortably它需要能够舒适地装配
210within that memory range.在那个记忆范围内
211So if you have 32 gigabytes of VRAM所以,如果你有32千兆字节 VRAM
212and a model is 25 gigs, that's fine.一个模型是25个工作,没关系。
213You'll be able to run it, right?你会运行它,对不对?
214However, one thing to keep in mind with memory不过,有一件事要记住
215is also the speed of the memory.也是内存的速度。
216So while you will be able to run much larger models所以当你可以运行 更大的模型
217on things like modern Macs that have 128 gigabytes在像现代Macs这样的 有128千兆字节的东西上
218of unified memory, the inference speed of those models这些模型的推论速度
219is gonna be much slower than a similar model比一个类似的模型慢得多
220that's running on something like a dedicated GPU运行在像一个专用GPU的东西上
221或Nvidia RTX GPU. (中文(简体) ).
222The reason for this is the speed of the memory.其原因是记忆的速度.
223So while the memory will dictate the size of the model所以虽然记忆会决定模型的大小
224and the more memory you have,越多的记忆,
225the smarter models you can run,你能够运行的更聪明的模型,
226the memory speed matters for the tokens per second每秒符号的内存速度很重要
227and the inference speed that you're going to be able和推论速度 你将有能力
228to generate.生成。
229There's a lot of different techniques here这里有很多不同的技术
230and things that I could get into,和我可以进入的东西,
231but generally speaking,但总的来说,
232if we talk about dedicated graphics cards,如果我们谈论专用显卡,
233again, typically in the Nvidia family,通常在恩维迪亚家族,
234these are much faster, sometimes two or three times faster速度快得多 有时快两三倍
235at inference speed, but they usually have less capacity.在推论速度上, 但他们通常能力较低。
236So for example, I have 24 gigabytes of VRAM in my 4090比如,我4090年有24千兆字节的VRAM
237and it's very fast and can generate 200 tokens per second它的速度很快,每秒能产生200个令牌
238for some of the models that I run.我运行的一些模型。
239However, I can't run models that are 70 billion parameters但我不能运行700亿参数的模型
240like I might be able to on my Mac.碞钩ии沉
241However, on my Mac, those models are really slow然而,在我的Mac上,这些模型真的很慢
242because the memory speed is significantly slower.因为内存速度明显较慢.
243So you're going to be looking at memory speed所以你要看记忆速度
244as well as memory capacity.以及记忆能力。
245Those are the two things that are going to dictate这些是两件事要决定的
246what you can do with local AI.你对本地的AI能做什么?
247And there's always going to be a trade-off总是有取舍
248in terms of the size of the model从模型的大小来看
249and the inference speeds that you're getting.和你的推论速度。
250Typically smaller models are going to be much faster.通常较小的模型会更快
251And again, the most important thing再说一遍,最重要的是
252is that whatever model you run,是无论你运行的模型,
253it needs to fit in this memory它需要融入这个记忆
254while it still can run if it's not in there,如果里面没有它 还能运行
255it's going to be so slow that it's practically unusable.速度会太慢 以至于无法使用
256Generally speaking, if you're looking at models一般来说,如果你在看模特儿
257between 14 and 35 billion parameters,140亿至350亿参数之间,
258those are going to be a really good sweet spot.这将是一个非常好的甜点。
259They're going to give you pretty decent performance他们会给你一个很好的表演
260and you're not going to feel你不会觉得
261like you're missing out on too much.就像你错过了太多。
262If you go up to huge models,如果你去大模型,
263like 120 billion parameters, 250 billion parameters,比如1200亿参数,2500亿参数,
264you're talking about needing extremely high-end hardware你说的是需要非常高端的硬件
265running at slow inference speeds.以缓慢推论速度运行。
266And it's very difficult to actually run those很难真正运行这些
267at scale on your own machine.在自己的机器上。
268Anyways, with that in mind, let's keep going here.无论如何,考虑到这一点, 让我们继续在这里。
269I want to tell you about something really interesting.我想告诉你一些有趣的事
270Now the whole reason you'd even bother现在的整个原因 你甚至会烦恼
271running models locally comes down to one main thing,本地运行的模型 归根结底是一件事,
272which I know you all want, which is control.我知道你们都想要的 这就是控制
273You pick the model, you own the setup你选模特儿,你自有一套
274and nobody can change the deal in.没有人可以改变交易。
275But here's the problem, right?但问题是,对吧?
276Almost every tool that you'd actually want to use几乎每个工具 你真正想要使用
277locks you into one provider's model.把你锁在一个供应商的模型里
278Now that's exactly what Mindhub Cowork,这正是明德胡布同事
279who's the sponsor of today's video, is built to fix.谁是今天录影带的赞助商 是用来修复的
280Now it's open source, free to use,现在它是开源,自由使用,
281and it has a real model router.它有一个真正的模型路由器。
282你可以经营Claw、GPT、Chaminade、Jeepseq
283or the same local models that I've been talking about或者我一直在谈论的本地模特儿
284right here, all inside of this workspace.在这里,所有在这个工作空间内部。
285So the workflow is simple.所以工作流程很简单。
286You brief the built-in agent harness, which is Anton,你向内置特工介绍一下 也就是安东
287walk away and come back to finished work.走开,回来完成工作。
288Now I asked it to research the latest coding models现在我要求它研究最新的编码模型
289and build me a comparison dashboard.帮我造一个比较仪表板
290And this is what it came back with,这就是它回来的原因
291an actual dashboard that I can open and share,一个真正的仪表板 我可以打开和分享,
292not just a wall of text.不只是文字墙。
293And this is the part that connects这是连接的部分
294to everything in this video.给这段录像里的所有内容
295When a better model drops,当一个更好的模型下降,
296whether it's local or a cloud model,无论是本地还是云型
297I can swap it in and I don't have to change anything.我可以把它换进去,我不需要改变任何东西。
298So I have the same workspace, the same work,所以我有相同的工作空间,相同的工作,
299and since it's fully open source,既然它完全开源
300you can clone the repo,你可以复制Repo,
301spin it up locally in just a few commands,转动到局部 仅几个命令,
302or just download the dedicated Mac or Windows app.或者只下载专用的Mac或Windows应用程序.
303The whole thing runs on your own hardware,整个事情运行在你的硬件上,
304which is basically the end game这基本上是结束游戏
305of what we're testing today.今天的测试
306Now they also have a hosted version,现在,他们还有一个主机版本,
307but honestly, I love the desktop app但老实说,我喜欢桌面应用
308as it's very easy to use.因为它很容易使用。
309So I'm gonna leave a link to it in the description.所以我要在描述中留下一个链接。
310Try it out.试试看
311Again, it really goes nicely with these local models.再一次,它真的 与这些当地模型。
312And now let me show you现在让我告诉你
313how we can actually run local models.如何实际运行本地模型。
314So there's a lot of ways to run a local model.因此当地模式的运行方式很多.
315And just like anything in software,就像软件里的任何东西一样
316it really comes down to how much control you want.这真的取决于你想控制多少
317So I've broken this into four different tiers.所以我把它分为四层。
318Now at the top, we've got LM Studio.现在最上面的是LM工作室
319This is a regular desktop app.这是普通的桌面应用程序 。
320You can click, you can download, you can touch everything,你可以点击,你可以下载, 你可以触摸一切,
321and you don't really need to go into the terminal.而你真的不需要进入终端。
322Now below that, we have Olamo.下面是奥拉莫
323This is a really popular option, especially for developers,这是一个非常流行的选择, 特别是对开发者来说,
324and it's just one command inside of your terminal它只是一个命令 在你的终端内部
325where you can talk with models, spin up a local server.您可以与模型交谈, 旋转本地服务器。
326You get the idea.你得到这个想法。
327然后我们有了Docker Model Runner。
328Now this is really good现在,这是真的好
329because it treats models like containers,因为它对待模型 像容器,
330which is perfect if you're actually gonna be deploying如果你真的要部署,那就完美了
331these alongside live applications.它们与现场应用同时存在。
332And at the bottom of my list here, we have full code.在我的名单底部, 我们有完整的代码。
333This is where you're running a model in pure Python这就是你运行一个模型 在纯Python
334and you see every single piece.你可以看到每一块。
335Now, no matter which way you wanna run these models here,现在,不管你想用哪种方式运行这些模型,
336you're gonna be making three decisions.你会做出三个决定
337You're gonna pick a model,你要选一个模特儿
338you're gonna pick a size and quantization你会选择一个大小和量化
339that fits inside of your memory,这符合你的记忆,
340and you're gonna decide how you wanna talk to it.你要决定怎么跟它说话
341So whether that's a chat window or something like code.所以,无论这是一个聊天窗口 还是类似代码的东西。
342If you keep that in mind,如果你记住这一点,
343every single one of these tools is gonna make sense.这些工具中的每一个都会有意义
344So let's start at the top.故从上起.
345And again, I'm gonna go through all of them再说一遍,我要翻遍他们所有
346and show you exactly how to run local models.告诉你如何运行本地的模型。
347Let's dive in.让我们潜入。
348So the first tool on my list here is LM Studio.我的第一个工具是LM工作室。
349I'll give you a quick walkthrough,我给你一个快速的走过,
350but this is one of the best ways to run local models.但这是管理本地模型的最佳方法之一
351Now, once you download the tool again, it's completely free,现在,一旦你再次下载工具, 它是完全免费的,
352you're gonna be brought into a view你会被带入风景
353that looks something like this.看起来像这样
354From here, you're gonna go into the model view,从这里开始,你会进入模型视图,
355looks like kind of a robot icon on the left-hand side,看起来像是左边的机器人图标
356and you'll be able to search你就可以去寻找
357through all of the available models通过所有可用的模式
358that you can download directly here.您可以在此直接下载。
359Now, what you'll wanna do is search for a model现在,你想做的是寻找一个模型
360that matches the kind of relative size匹配相对大小的类型
361or amount of memory that you have.或你的记忆量
362Again, if we're talking about larger high-end machines,再说一遍 如果我们说的是更大的高端机器
363you can typically get away with 27 billion, 35,你通常能逃出270亿 35亿
36430 billion parameters, et cetera.三百亿参数等.
365If you have eight gigs of RAM or 16 gigs of RAM,如果你有8个工作 或16个工作 RAM,
366look for ones that are eight billion parameters寻找80亿的参数
367or four billion parameters, much smaller sizes.或40亿参数,大小小得多。
368So for example, we have Gwen 3.8.例如,我们有格温3.8。
369You'll notice that if I click on this,你会注意到,如果我点击这个,
370I can view different levels of quantization我可以看到不同层次的量化
371and see the change in size right here.看这里大小的变化
372You also see kind of some icons or indications您还看到一些图标或指示
373of which model is the best for you based on your hardware.根据你的硬件,哪个型号最适合你。
374So you can see when it says full GPU offload possible所以你可以看到,当它说全GPU卸载的可能性
375and a little thumbs up,并竖起一小拇指,
376that's the one that you would wanna go with.那是你想去的那个
377And notice this number of Q4,注意这个Q4的号码
378that's the level of precision or the quantization level.这是精确度或量化度。
379So the lower, so like Q4, Q2, Q1,所以越低,就像Q4,Q2,Q1,
380the more quantization you have, right?越多的量化,对不对?
381So if you have Q8, you can see this is bigger所以,如果你有Q8,你可以看到 这是更大的
382than Q6 or Q4, and it's a pretty drastic difference.比Q6或Q4, 这是一个相当巨大的差异。
383You're also gonna wanna look at the capabilities,你也想看看他们的能力
384so vision, tool use, reasoning.因此,视觉,工具的使用,推理。
385If you need it to be able to analyze images, you need vision.如果需要它才能分析图像,就需要视觉.
386If you want it to work in an agentic harness如果你想让它在 代理化的绳子上工作
387or an agent mode, you need tool calling.或代理模式,您需要工具呼叫。
388Hopefully you get the idea.希望你知道这个主意
389There's so many models,这么多模特儿
390I can't possibly go through all of them,我不可能通过他们所有的,
391but you get the idea you can browse through here但你有这个想法 你可以浏览这里
392and look at the ones that are going to match看看那些会匹配的
393your specific hardware and the sizes that make sense.您的特定硬件和大小 合理。
394Now, once you download the model,现在,一旦你下载模型,
395you can view your models from the model tab right here.您可以在这里查看模型标签。
396Now, in order to use these models,现在,为了使用这些模型,
397you do need to load them.你确实需要加载它们。
398So if I select a model like Gemma 4,所以如果我选一个像Gemma4的模特儿
399and I just bring open this sidebar here,我只是把这个侧柱打开,
400it will give me some options for actually loading它会给我一些选项 实际加载
401and running my model.和运行我的模型。
402So what I may wanna do here is go to the load tab所以,我想在这里做的是 去负载标签
403and start changing some of the values.并开始改变一些值。
404If you're a beginner, don't change anything如果你是初学者,不要改变任何东西
405and just run this directly.然后直接运行这个。
406The one thing you can't have a look at只有一件事你无法看
407is the context size here.这里为上下文大小。
408And keep in mind, the larger you make this context size,记住,你做的这个背景尺寸越大,
409the more room is gonna be taken up in your computer's memory在你的电脑记忆中,会占用更多的房间
410because all of this context needs to actually fit因为所有这些背景都需要实际适应
411in the GPU memory, right?在GPU的记忆,对不对?
412Or the memory that you have for running local models.或者你运行本地模型的记忆。
413There's a bunch of other settings you can use,还有一堆其他的设置你可以使用,
414but in this case,但在这种情况下,
415what we're gonna do is just load the model.我们要做的就是装上模型
416Now, when we load the model,现在,当我们加载模型,
417same thing it asks us for the settings.同样的东西 它要求我们设置。
418We're gonna go ahead and load that.我们要继续装货
419It will take a second,需要一点时间
420and then we will be able to view that here然后我们可以在这里看到
421from this terminal view从此终端视图
422and also chat with it directly from the chat window.还直接从聊天窗口与它聊天。
423You can load multiple models at once,你可以马上装上多个模型,
424and you'll be able to see the models that are loaded up here你会看到装满的模型
425as well as the size and then to check them.还有大小 然后检查一下
426So you can see that I'm currently using 5.58 gigabytes所以,你可以看到,我目前使用5.58千兆字节
427of the 63 gigabytes of RAM that I have.我拥有63千兆字节的RAM
428However, we're talking about GPU memory here,但是,我们说的是GPU的记忆,
429so that's not really 100% accurate.所以这不是真的100%准确。
430So if we go here to the terminal,如果我们到终点站
431we can now see that this model is loaded.我们现在可以看到这个模型已经装满了。
432I can view all of the API stuff for this我可以看所有API的东西
433in case I'm a developer and I wanna directly chat with it以防我是开发商 我想直接和它聊天
434using something like a curl command.使用类似卷曲命令。
435If that doesn't make sense to you, don't worry.如果你觉得不合理 别担心
436If you just wanna chat with the model,如果你想和模特儿谈谈
437you can go over to the chat view.你可以去聊天视图。
438So from here, we'll press new chat.因此,从这里,我们将按新的聊天。
439We're just gonna select the model that's already loaded.我们只是要选择 已经上膛的模型。
440因此谷歌Gemma 4.
441We can modify things here, for example,我们可以在这里修改,比如,
442like the system prompt if we wanna do that.如果我们想这么做 系统就会启动
443And then we can just start chatting directly with the model然后我们就可以直接和模型聊天了
444just like we would inside of something like chat GPT.就像我们在里面 喜欢聊天GPT。
445Now you can see this one is extremely fast, right?现在你可以看到这个非常快,对不对?
446We're getting 120 tokens per second我们每秒得到120个金币
447because it's very small.因为它很小。
448And again, I have high memory bandwidth再说一遍,我的记忆带宽很高
449because I'm using a dedicated GPU.因为我在使用专用的GPU.
450You can load multiple models您可以装入多个模型
451as long as they all fit into the memory here.只要他们都融入这里的记忆
452And then again, you can adjust all of the parameters.然后,你可以调整所有参数。
453And if you want to, you can start using them如果你想,你可以开始使用它们
454from this server, which is useful, especially for coding.来自此服务器, 特别是用于编码 。
455And you can see the full logs of everything that's gone on,你可以看到所有事情的完整记录
456tokens per second speed.每秒速度的符号。
457You get the idea.你得到这个想法。
458LM Studio is very good.LM工作室非常不错.
459There's a lot you can do with it.诸法无量.
460And if you want a full tutorial,如果你想要一个完整的教程,
461leave a comment down below and I will go into it.下面留点意见,我再谈
462So the next tool on my list here is Olama.我名单上的下一个工具是奥拉玛。
463Now this is a little bit more popular for developers这对开发者来说更受欢迎
464它和LM Studio有很相似之处
465However, it's a little bit less visual然而,它有点少视觉
466and gives you a bit less control.让你少点控制力
467Now Olama is a very popular way for downloading现在奥拉玛是一个非常流行的下载方式
468and running local models.并运行本地模型。
469In order to use it, you do need to download the tool.为了使用,您确实需要下载工具.
470所以你可以直接去olama.com
471and it will be available inside of your terminal在你的终端里可以找到它
472as a command.作为命令。
473So if you type Olama in your terminal once it's downloaded,所以,如果你打 奥拉玛在你的终端 一旦下载,
474sorry, you should see something like this对不起,你应该看看这样的东西
475where you can launch it for all kinds of tools在那里你可以推出它 各种工具
476or you can directly chat with different models.或者你可以直接和不同的模型聊天。
477Now, as well as the terminal or CLI based tool,以及终端或基于CLI的工具
478there is also a visual tool that you can open还有一个可以打开的视觉工具
479when you download the desktop application.当您下载桌面应用程序时。
480From here again, you can launch Olama再来一次,你可以发射奥拉玛
481inside of any of these harnesses在任何这些绳子里面
482and use models that you've downloaded.并使用你下载过的模型。
483You can go into the settings, right?你可以进入环境,对不对?
484Or you can actually just start chatting或者你可以开始聊天
485with different models by selecting one通过选择一个来使用不同的模型
486of the ones that you have.你拥有的。
487Now, in order to download models in Olama,现在 为了在奥拉玛下载模型
488what you're gonna do is start by finding the model你要做的是从找到模型开始
489that you want.说你想说的
490So you're gonna have to go to the Olama hub.所以你得去奥拉玛中心
491So by doing that, you can go Olama and then Models.因此,通过这样做,你可以去奥拉玛和模型。
492From here, there's a bunch of models从这里,有一群模特
493that are available for Olama.给奥拉玛的
494Same thing, you can search through them.同样的事情,你可以搜索 通过他们。
495You can ask ChatGBT to help you find one.你可以请ChatGBT帮助你找到一个.
496And if you find a model that you want,如果你找到一个你想要的模型,
497so actually let's go maybe NemoTron 3.5 Lightning here,因此,实际上让我们去 也许尼莫特龙3.5闪电在这里,
498we can see all the different sizes.我们可以看到所有不同的尺寸。
499We now understand what B stands for我们现在明白B代表什么
500and what quantization is, right?而什么是量化,对不对?
501So we can have a look at them here好让我们看看这里
502and we can pull them directly inside of Olama.我们可以直接把他们拉进奥拉玛
503So the way this works is the following.因此,这个方法是:
504First, you can type Olama list.首先,你可以输入奥拉玛列表.
505If you type list, this will show you all the models如果您输入列表, 这将显示所有模型
506you currently have downloaded.您已下载 。
507And then if you wanna pull a model, you'll type Olama pull然后,如果你想拉一个模型, 你会打奥拉玛拉
508and then the model ID that you found from the model hub.然后从模型中心找到的模型ID。
509This is gonna download it to your computer这个会下载到你的电脑上
510and then allow you to start using it.然后让你开始使用它。
511If you wanna run a model, you can type Olama run如果你想运行一个模型,你可以打 奥拉玛运行
512and then put the model ID.然后把模式ID。
513So I'm gonna put NemoTron 3 like this所以我要把尼莫特龙3这样
514and it will start the model.它会启动模型。
515It will load it into my computer's memory.它会把它装进我电脑的记忆里
516This is why we'll always take a second at the beginning这就是为什么我们总是在开始的时候花一秒钟
517cause it actually needs to load it.因为它实际上需要加载它。
518Then you can start chatting with it那你可以开始跟它聊天了
519directly from this view.直接来自此视图。
520So here you can see, I can type something like hello world所以这里你可以看到,我可以打一些东西 像你好世界
521and I can just directly start using this local model.我可以直接开始使用这个本地模型。
522Now, as well as that, I can do that from this terminal view.现在,还有,我可以从这个终端的角度来做。
523So if I go to, let's go NemoTron nano or something,所以,如果我去, 让我们去尼莫特龙纳米什么的,
524I can type hello.我可以打个招呼。
525Same thing, we need to wait for it to be loaded同样的事情,我们需要等待它被装上
526and then it will give us a response.然后它将给我们一个回应。
527Sometimes it takes a second, especially on the first load有时要花点时间 尤其是第一次
528but you can see we get the thinking但你可以看到 我们得到的想法
529and then we get the response.然后我们得到回应。
530And if we go back here, hello, how can I assist you today?如果我们回到这里,你好,我有什么可以帮助你今天?
531Now this is great,现在,这是伟大的,
532but Olama will also expose all of its services on an API.但奥拉玛也会在API上曝光它的所有服务.
533So for example, if I type Olama help,比如,如果我输入奥拉玛的帮助,
534you're gonna see an option你会看到一个选择
535of all of the different things that you can do.所有不同的事情 你可以做的。
536As long as Olama is running,只要奥拉玛在跑
537it will actually serve all of its models它实际上将服务于它的所有模式
538available on a default port.在默认端口上可用。
539I don't remember exactly what the port is我不记得港口到底是什么
540but I believe it's something like 11,434,但我相信是11,434号
541which means that you're actually able to send curl requests也就是说你实际上可以发出卷曲请求
542and use Olama from other tools并使用其他工具中的Olama
543as long as it's running in the background.只要它运行在背景。
544I'm not gonna go into a full tutorial of it我不会去一个完整的辅导它
545but if you're a developer and you understand但如果你是一个开发者 你明白
546what a REST API is,何等为雷斯特API,
547Olama provides that already with access奥拉玛已经提供 已经进入
548to all of the models.给所有的模型。
549It will automatically load any model that you ask it for它会自动加载任何您想要的模型
550whenever you try to send a request to it.当你试图向它发出一个请求。
551It actually has what's called an OpenAI compatible API它实际上有所谓的OpenAI兼容API
552which means that you will be able to send requests这意味着您将可以发送请求
553in the same format that you would格式与您将采用的格式相同
554像ChatGBT或者Anthropic之类的
555Anyways, that is Olama.总之,那是奥拉玛。
556Let's go to the next example.复次举譬.
557So the next tool on my list here is the Docker Model Runner.我名单上的下一个工具是Docker模型运行器。
558Now this is available as an experimental feature现在这个是实验性的
559在 Docker 桌面内。
560There is a bunch of restrictions with it.有很多限制。
561However, if you are gonna be doing this但是,如果你要这样做
562在 Linux 机器上
563and you have Nvidia hardware, it works very well.你有Nvidia的硬件, 它的工作非常好。
564It can work on CPU as well, I believe,CPU也有用,我相信,
565however, it's extremely slow.然而,这是极其缓慢的.
566So with Docker Model Runner,因此,与多克模型运行者,
567if you go into Docker desktop, there is some settings如果您进入 Docker 桌面, 有些设置
568I believe you need to enable this experimental feature.我相信你需要启用这个实验功能。
569You should see this Models tab.你应该看看这个模型标签。
570From the Models tab, you'll be able to go to Docker Hub从模型标签,你可以去Docker枢纽
571and then here you can pull all of the same type of models然后在这里,你可以拉 所有相同的型号
572as you would be able to inside of like Olama or LM Studio.就像奥拉玛或LM工作室
573Once you have a model here, you can chat with it directly.一旦你有一个模型在这里,你可以直接与它聊天.
574So I have Gemma 3, for example,所以我有Gemma 3,例如,
575same thing, it will automatically load the model for me.同样的,它会自动加载模型给我。
576And then I can type something like hello.然后我可以打一个像你好的东西。
577Now, similarly to all of the other tools,现在,和所有其他工具一样,
578this will also expose a REST API on a different port.这也将会在不同的端口暴露一个REST API.
579I believe it's 12,434 or 343我想是12,434或343个
580that will allow you the ability to chat with these models这样你就能和这些模型聊天
581without being directly inside of this interface.而不直接在此界面内。
582You can also inspect the model,你也可以检查模型,
583see all the information about it, et cetera.见一切诸法等.
584What's interesting about the Docker Model RunnerDocker模型运行器有什么有趣的
585is that it actually treats models like containers.实际上它把模型当成容器
586What that means is that you can write Docker files,这意味着你可以写Docker文件,
587you can write compose files,你可以写作曲文件,
588and you can actually have models shipped directly也可以直接运出模型
589with your applications and be dependencies exposed与您的应用程序并暴露依赖关系
590through Docker kind of services,通过多克的服务,
591which is a lot more complicated这要复杂得多
592than I'm going to get into in this video.而不是我要进入这视频。
593But if you do use Docker and you're familiar with this但是如果你真的用Docker 你熟悉这个
594and you use it for your apps and you want local models,你用它来做你的应用 你需要本地的模型,
595this is a really good way to deploy them.这是部署他们的好办法
596Now, I'll also show you that there is a CLI based tool.现在,我还要告诉你,有一个基于CLI的工具.
597So similarly to what we had before,跟我们以前一样
598if I type something like Docker model,如果我输入的东西 像Docker模型,
599you can see that we can configure,你可以看到,我们可以配置,
600inspect, install the runner, push RM,检查,安装跑者,推RM,
601view the models, load, unload.查看模型,装货,卸货。
602You guys get the idea你们知道这个主意
603and you can view models directly inside of here as well.也可以直接在这里查看模型
604So this is a really powerful feature.这是一个非常强大的特征。
605And if you want a full tutorial on it,如果你想要一个完整的辅导,
606I have actually done that on my channel.我确实在我的频道上做了
607You can see the easiest way to run LM's locally,你可以看到最简单的方法 运行本地的LM,
608Docker Model Runner tutorial,Docker 模型运行器教程,
609goes through all of the features通过所有的特性
610and we'll even show you all of the Docker files我们甚至会给你们看所有的Docker文件
611and how to set it up with the automatic deployment.和如何设置它与自动部署。
612好吧,这是Model Runner。
613Now let's move to the last one, which is full code.现在,让我们移动到最后一个, 这是完整的代码。
614Okay, so the last example I have for you好,我给你的最后一个例子
615is actually running models using just code.正在使用简单的代码运行模型。
616So this means that we're actually gonna bring所以这意味着我们真的会带来
617in our own inference engine, in this case, Llama CPP,在我们自己的推论引擎中, 在本案中,Llama CPP,
618and not rely on something like Olama而不是依赖象奥拉玛一样的东西
619或者Docker Model Runner 或者LM Studio来为我们做这个
620Now, the big surprise is that Llama CPP is the engine现在,最大的惊喜是Llama CPP是引擎
621that pretty much all of the tools that we just looked at几乎所有的工具 我们刚刚看
622are already using,已经在使用,
623but if we want to invoke it directly ourself,但如果我们想直接援引它,
624we can do that.我们可以做到这一点。
625So for example, you'll see we have this Gwen 2.5 model,比如说,你会看到我们有Gwen 2.5模型
626which I've downloaded locally on my computer.我从电脑上下载的
627Again, this is literally just a file再说一遍,这只是一个文件
628that contains a bunch of numbers.里面有一堆数字
629Now, if I want to run this,现在,如果我想运行这个,
630normally I would need a Llama or something like that,通常我需要拉玛之类的东西
631but I can actually write code但我可以写代码
632that will invoke it directly for me.它会直接为我引用它。
633So you'll see that I can just load the model.所以你会看到,我可以只是装上模型。
634I can then create a response using this package.然后,我可以用这个软件包创建一个响应。
635And if I just run the code here,如果我在这里运行密码
636you will see that I get the following.你会看到,我得到以下。
637In my heart, I run AI on my desk running free,在我的心里,我运行AI在我的桌子上 免费运行,
638and it wrote me write a haiku or whatever you call this它写我写一个海库 或任何你所谓的这个
639about running AI on your own computer.关于运行AI 在自己的计算机。
640Now I can change this prompt to be,现在我可以改变这个速度,
641hey, who is Tim or something?嘿,谁是蒂姆什么的?
642I don't know if that's gonna give us anything meaningful,我不知道这会不会给我们带来什么意义
643but let's run this.但让我们运行这个。
644And Tim is a character from a popular video game,蒂姆是一个流行电子游戏的人物
645whatever, right?随便吧?
646So this is a very small model.这是一个很小的模型。
647Of course, it's not gonna give us good responses,当然,它不会给我们好的答复,
648but you get the idea.但你明白这个想法
649We can run it fully locally.我们可以完全在当地运行。
650Now, one thing to keep in mind is that as well as doing this,现在,有一件事要记住 除了这样做,
651we can actually chat with models我们可以和模特儿聊天
652that are running on our own computer正在我们自己的电脑上运行
653through services like a Llama.像Llama这样的服务。
654So like I was mentioning,就像我刚才提到的那样
655if a Llama is installed and running,如果一个Llama安装和运行,
656you can specify the model that's actually available您可以指定实际可用的模型
657在你下载的Llama。
658And then similarly to before,跟以前一样
659I can run something like this.我可以运行这样的东西。
660In this case, it's gonna be a bit slower这样的话,会慢一点
661because Llama 2 is much larger.因为Llama 2是更大的。
662And you'll see that we actually get the response, right?你会看到,我们实际上得到了回应,对不对?
663And it says, hey,它说,嘿,
664someone might choose to run an AI model locally,有人可能会选择在当地运行一个AI模型,
665blah.
666And it's using that a Llama backend service.它使用Llama后端服务。
667And if I wanted to,如果我想的话,
668I could even change this to the LLM API, right?我甚至可以把它改成LLM API,对不对?
669或 LM Studio API 或 Docker 模型运行器 API
670and do the exact same thing right from code.并做同样的事情 从代码。
671So this is kind of the more manual method,所以,这是一种 更手工的方法,
672but most developers are gonna end up managing their models但大多数开发者最终会管理他们的模型
673through something like a Llama.穿过像Llama的东西。
674And then invoking them in code using a method like this.然后用这种方法在代码中引用它们。
675Okay, so that wraps up the demos.好吧,这样就结束了演示。
676Now let's talk about which method you should actually use.现在我们来谈谈你应该使用哪种方法。
677So here's my honest take.所以,这是我诚实的拍摄。
678If you just wanna chat with the model如果你想和模特儿谈谈
679and you never wanna see a terminal,你从不希望看到一个终端,
680then you can use something like LM Studio.这样你就可以用LM工作室了
681It's genuinely one of the easiest ways to download models这是最容易下载模型的方法之一
682and has some of the most amount of features.并且拥有一些数量最多的特征.
683If you're a developer and you want a model如果你是开发商 想要一个模型
684running on your own machine在自己的机器上运行
685that your scripts and apps can talk to,你的剧本和应用程序可以说话,
686definitely use a Llama.绝对要用拉玛
687That's what I reach for most days大部分时间我都是这样
688and it works really well locally.并且它在当地非常有效。
689If you're already living inside of a Docker container如果你已经住在多克容器里
690and you want models sitting in that stack right next to you,你想让模特坐在你旁边
691然后使用Docker Model Runner,对吗?
692It's really good in production生产真的很好
693if you're actually building and deploying things out.如果你真的在建造和部署东西。
694And lastly, if you wanna understand最后,如果你想了解的话
695everything that you're doing and run models yourself你所做的一切,你自己经营模特
696in probably the most efficient way,也许是最有效的方式,
697then you can use your own code to do so.那样你就可以用你自己的代码了
698Of course, you don't need to use Python.当然,你不需要使用Python。
699This is just a quick example.这只是一个简单的例子。
700And with that in mind, just remember记住这一点,只要记住
701that all of these tools at the end of the day最后这些工具
702are using the same building blocks使用相同的组件
703that we talked about earlier.我们之前说过的
704They have a model, which again,他们有一个模型,再次,
705is literally just a bunch of numbers in a file字面上只是文件里的一堆数字
706and they have an inference engine他们有一个推论引擎,
707and a bunch of other fancy features on top of it.上面还有一堆其他的花样
708If you understand that, you understand local models如果你明白这一点,你就明白本地的模型
709and hopefully this video helped get you off the ground希望这段视频能帮助你脱身
710and running your first one on your own device.然后用自己的设备运行第一个
711Anyways, guys, that's all that I have for you.总之,伙计们,我只有这些了
712If you enjoyed, make sure to leave a like, subscribe,如果你喜欢, 确保离开类似,订阅,
713and I will see you in the next one.我会看到你在下一个。
714Thanks for watching.谢谢你的观看。
715Bye.再见。
该视频共有字幕 715 条。解锁更多字幕为会员功能,请移动到 价格

P2 · 【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南 p02 英文字幕 (P2)

字幕摘录

时间英文中文
0:00Everybody is talking about running AI locally,大家都在谈论本地的人工智能
0:03but almost nobody explains what it is但几乎没人解释是什么
0:05or how you actually get it to work.或者你如何真正让它工作。
0:07Now you get these videos where people throw around terms现在,你得到这些视频 人们扔周围的条件
0:09如重量或量化、VRAM、GGUF、
0:13and it sounds like you need a PhD听起来你需要博士学位
0:15and a $10,000 computer just to try this out.和一万块的电脑 只是试试这个。
0:18And that's exactly why most people give up这就是为什么大多数人放弃
0:20and just keep paying for subscriptions like ChatGPT.继续支付像ChatGPT这样的订阅费.
0:23So let me give you the honest one sentence version here.所以,让我给你一个诚实的句子。
展开字幕全文(715 条)
序号英文中文
1Everybody is talking about running AI locally,大家都在谈论本地的人工智能
2but almost nobody explains what it is但几乎没人解释是什么
3or how you actually get it to work.或者你如何真正让它工作。
4Now you get these videos where people throw around terms现在,你得到这些视频 人们扔周围的条件
5如重量或量化、VRAM、GGUF、
6and it sounds like you need a PhD听起来你需要博士学位
7and a $10,000 computer just to try this out.和一万块的电脑 只是试试这个。
8And that's exactly why most people give up这就是为什么大多数人放弃
9and just keep paying for subscriptions like ChatGPT.继续支付像ChatGPT这样的订阅费.
10So let me give you the honest one sentence version here.所以,让我给你一个诚实的句子。
11That is that local AI is simply a model file这就是说本地的AI只是一个模型文件
12that's sitting on your computer and a program that runs it.坐在你的电脑和运行程序上
13That's it.就这样
14No cloud, no API keys, no internet, no subscription.没有云,没有API键,没有互联网,没有订阅.
15Everything else is really just a small detail.其他一切都只是个小细节
16So in this video, I'm gonna break down因此,在这个视频中,我要打破
17what's actually happening under the hood,引擎盖下到底发生了什么
18the real building blocks, and none of the fluff.真正的建筑构件, 和没有绒毛。
19And then I'm gonna show you how to run a model然后我会告诉你如何运行一个模型
20on your own machine in four completely different ways,在你自己的机器上 四种完全不同的方式,
21from an app that you download从您下载的应用程序中
22all the way to pure low-level code一直到纯低层代码
23where you're running it yourself.在那里你运行它自己。
24Now by the end of this video,现在,在这个视频结束时,
25you're gonna understand local AI你会明白本地的AI
26better than most people that are posting about it.比大多数贴报的人要好
27So let's dive in.所以让我们潜入。
28So first, let's clear up先说清楚
29the most common confusion that I see.我所看到的最常见的混乱
30Now that's what's actually different这才是真正的不同
31between something like ChatGPT and a local model.在像ChatGPT之类的东西 和本地模型之间
32Now when you use ChatGPT, Cloud, Gemini,当你使用ChatGPT,云,双子座,
33really any of these tools,任何这些工具,
34what's happening is that you type a message,发生的事情是 你输入一个消息,
35that message leaves your computer,留言留下你的电脑,
36it travels over the internet to something like a data center它在互联网上游历到一个像数据中心的东西
37where a massive computer that you don't own你没有的大型电脑
38runs a giant model,运行一个巨大的模型,
39and then the answer gets streamed back to your screen.然后答案被流回你的屏幕。
40So your computer did basically nothing.所以,你的电脑基本上什么都没做。
41It's really just a window into somebody else's machine.它真的只是一个窗口 进入别人的机器。
42Now local AI completely flips that.现在本地的AI完全推翻了这一点.
43The model, so the actual file模型,所以实际文件
44that contains all of the intelligence包含所有情报
45gets downloaded onto your computer.下载到电脑上
46And when you ask it a question,当你问这个问题时,
47your own CPU or GPU is the one that's doing the work.您的CPU或GPU是 做这项工作。
48So nothing leaves your machine,所以,没有什么离开你的机器,
49and that gives you three big advantages.这给你三个大优势
50Now first, it's private.现在,首先,这是私人的。
51That's because your data never goes anywhere,那是因为你的数据从不消失
52it stays on your computer.它留在你的电脑上。
53Second, it's free because there's no subscription第二,免费,因为没有订户
54and there's no per-token cost.而且没有每桶成本。
55And lastly, it works offline.最后,它的工作离线。
56So if you're in a plane or a coffee shop with terrible Wi-Fi,所以,如果你在飞机或咖啡店 用可怕的无线,
57doesn't matter, you can use these local models.无所谓,你可以使用这些本地模型。
58Now I do wanna be honest here about the trade-offs,现在,我想诚实地在这里 关于权衡,
59which is that the models that you're gonna be able也就是你能够做的模型
60to run at home are much smaller than the frontier models在家跑步比边疆模式要小得多
61that you'd use from something like Cloud or OpenAI.你会用在云或OpenAI之类的东西上
62But they have gone shockingly good但是,他们已经走了惊人的好
63over the last couple of years,在过去几年里,
64and for a huge amount of everyday tasks,和大量日常工作,
65even coding tasks, they're more than enough.甚至编码任务,它们都足够了。
66So with that said, let's have a look所以说,让我们来看看
67at the actual pieces here,在实际的作品在这里,
68so you understand local models much deeper.所以你更了解当地的模型
69Now the first part here is the model itself.现在第一部分是模型本身。
70And I wanna be really clear about what a model actually is,我想说清楚什么是模特儿
71because this is where some people imagine因为这就是一些人想象的
72some kind of magic black box.某种魔力黑盒。
73Now a model is literally just a file.现在一个模型其实只是一个文件。
74It's a really big file, could be hundreds of gigabytes,这是一个非常大的文件,可能是数百千兆字节,
75that's full of numbers that we call weights.我们称之为重量数
76Now these are billions of numbers这些是数十亿的数字
77that got baked in when the model was trained.当模特被训练时 被烤熟了
78Now that file doesn't think, it doesn't run,现在那个文件不思考,它不运行,
79it just sits there on your disk它只是坐在你的磁盘上
80like any other file that you would have.就像其他文件一样
81And companies like Meta, Google, Alibaba, Mistral, whatever,还有梅塔、谷歌、阿里巴巴、米斯特拉尔等公司
82they release these files for free.他们免费发布这些文件。
83Now those are your open models这些是你的公开模型
84and things that you keep hearing about和你们所听到的
85比如Llama或者Gemma或者Quen或者DeepSeq,你懂这个意思.
86You can literally just download them你可以直接下载
87because they are literally just a file因为从字面上来说,它们只是一个文件
88full of billions of different numbers.充满了数十亿个不同的数字。
89Now when you go to look at these models,当你去看这些模型时,
90you're gonna see names like four billion,你会看到40亿的名字,
91eight billion, 70 billion.八十亿七百亿.
92Now that B is billions,现在B是亿,
93and it stands for the number of parameters.它代表参数的数量。
94Now that's effectively just how many numbers现在,这是有效的 只是多少数字
95are inside of that file.里面的档案。
96And the rule here is pretty simple.这里的规则很简单。
97Generally speaking, more parameters means a smarter model,一般来说,更多的参数意味着一个更聪明的模型,
98but it also means a bigger file但它也意味着一个更大的文件
99that needs more memory and compute to run.这需要更多的记忆和计算运行。
100So if you look at an eight billion model,所以如果你看看80亿的模型
101this is maybe a few gigabytes in storage.这也许是几千兆字节的存储。
102Well, a 70 billion model is a file that's so large嗯,一个700亿的模型是一个文件 这是那么大
103that most laptops simply cannot even load it,大部分笔记本电脑都装不下
104and some may not even have enough storage to download it.而有些人甚至可能没有足够的存储器可以下载.
105Now that leads directly into the biggest trick现在,这直接 进入最大的诡计
106that happens with local AI.这发生在本地AI。
107Now this is something called quantization.这是所谓的量化。
108Now it sounds scary and really complicated,现在听起来很可怕,很复杂
109but it's really the same idea as compressing a photo.但它真的相同的想法 压缩一张照片。
110So you can take these billions of numbers这样你就可以拿这些亿万的数字
111and you can store them with less precision.并且可以更精确地储存它们。
112And that means that this model file这意味着这个模型文件
113is gonna get dramatically smaller就会变小
114with barely any quality loss at all.几乎没有质量损失。
115So a model that would normally need 16 gigabytes of memory所以这个模型通常需要16千兆字节的内存
116in its original form might only need five, six,原型可能只需要五,六,
117or seven gigabytes after quantization.或七千兆字节后
118And when you see the term gguf floating around,当你看到这个术语漂浮,
119that's basically just the standard file format这基本上只是标准文件格式
120for these compressed models.这些压缩模型。
121Now this is the entire reason that normal computers这才是正常电脑的原因
122can even run AI models at all,甚至可以运行AI模型,
123or at least some of the bigger ones.或至少一些较大的。
124So when you hear about quantization所以,当你听到关于量化
125or a quantized model,或被量化的模型,
126just think of that as a compressed model把这当成一个压缩模型
127that's meant to make it smaller so it's easier to run.意思是让它变小 所以它更容易运行。
128When you compress these models,当你压缩这些模型时,
129you keep almost the exact same performance,你保持几乎完全相同的表现,
130but again, you just reduce the size drastically,再说一次,你只是大大缩小了尺寸
131so it's a lot easier to actually run.因此,这很容易真正运行。
132Now the next piece is the inference engine.现在下一个是推论引擎。
133And this is the part that almost nobody explains.这是几乎没人解释的部分。
134Remember that the model is just a file full of numbers,记住,模型只是一个文件 充满数字,
135and a file can't run itself.并且文件不能自己运行。
136So you need a program所以你需要一个程序
137that can actually load these numbers into memory可以将这些数字装入内存
138and do the actual math to make the model work并做实际的数学 使模型工作
139and predict the next token.并预言下一个迹象。
140Now that program is called an inference engine.现在这个程序叫做推论引擎.
141Now the most famous one is called llama.cpp.现在最著名的一个叫做lama.cpp.
142And here's the secret,这是秘密
143almost every tool that I'm gonna show you today,几乎每一个工具 我今天要给你看,
144so LM Studio, Olamma, Docker Model Runner,因此LM工作室,奥拉姆马,多克模型运行器,
145they're all basically just a wrapper他们基本上都只是一个包装器
146around engines like this.绕着这种引擎
147Now the engine does all of the work,现在引擎完成了所有的工作,
148and the tool just kind of makes it nice to use,而工具只是 那种使它使用,
149which you're gonna see later on.稍后你会看到的。
150Now the last building block here is your hardware,最后一块是你们的硬件
151because there's really only one question因为只有一个问题
152that decides what local models决定何种地方模式
153you're going to be able to run.你会跑的
154Now that is, how much memory do you have on your computer,你电脑里有多少记忆
155and how fast is that memory?记忆有多快?
156Now on a PC with a graphics card,现在在一台带显卡的PC上
157so a dedicated graphics card,所以一个专用的显卡,
158that number is gonna be your VRAM.这个号码会是你的VRAM。
159So if you have an Nvidia 3090 or 4090 or 5090,所以,如果你有一个Nvidia 3090或4090或5090,
160or I'm just naming random GPUs,或者我只是命名随机GPU,
161you're gonna look at the VRAM on that device.你看看那个装置上的VRAM
162Now if you're running on a modern Mac computer,如果你在现代Mac电脑上运行
163就像M3或M4一样 任何M系列的MacBook
164then you're just gonna be looking at the amount of RAM那你就只能看看内存的数量
165that your computer has.你的电脑有。
166And that's because Apple shares its memory with the GPU,这是因为苹果公司与GPU共享其记忆,
167and has something called unified memory.并有所谓的统一记忆。
168Now other devices have different specifications,现在其他设备有不同的规格,
169but generally speaking,但总的来说,
170if you have a relatively new computer,如果你有一个相对新的计算机,
171if it has a dedicated graphics card,如果它有一个专用的图形卡,
172你看着VRAM。
173That's the amount of memory you're gonna have这就是你的记忆量
174for running local models.用于运行本地模型。
175And if you're on a Mac, again, a modern one,如果你在Mac上 又是现代的
176you're looking at the amount of unified memory.你在看统一记忆的量
177And the rule of thumb here is pretty simple.这里的拇指规则很简单。
178The model file needs to be able to fit模型文件需要适合
179inside of that memory that you have在你的记忆中
180with a little bit of room to spare.还有一点空位
181So roughly speaking,所以说,
182if you have eight gigabytes of VRAM or unified memory,如果你有8千兆字节 VRAM 或统一的内存,
183you're gonna be able to run three to four billion你会跑到三四十亿
184parameter models, even without being quantized.参数模型,即使没有被量化.
185And if you have 16 gigabytes of memory,如果你有16千兆字节的记忆
186you can go up to seven or eight billion parameter models.可以达到70或80亿个参数模型。
187And then if you go up to 32 gigabytes,然后如果你升到32千兆字节
188you start to be able to get into the 14你开始可以进入14
189to 30 billion parameter range.到300亿参数范围。
190And this is where things start to feel genuinely smart,而这就是事情开始 感觉真正聪明,
191especially for local models.特别是当地模特儿
192But keep in mind,但记住,
193you don't need a monster computer to do any of this.你不需要怪物电脑来做这些
194Even with something like your phone,即使是用你的手机一样的东西
195you can run small models already.你可以运行小模型了。
196And one thing that carries over from cloud AI还有从云中传来的一件事
197is that the context windows是上下文窗口
198to the model short-term working memory到模式短期工作记忆
199is going to actually affect the amount of space将会影响空间的大小
200that's being taken up.这正在处理中。
201So if you have long conversations, bigger documents, et cetera,所以,如果你有长话短说, 更大的文件等等,
202that's also going to fill up your memory.那也会让你的记忆充满
203Now I'm gonna explain this a little bit more in detail现在我要详细解释一下
204because this is super important.因为这很重要
205But the basic idea is that the one number但基本想法是,一个数字
206you need to be aware of is how much memory,你需要知道 有多少记忆,
207either VRAM or unified memory is on your computer.无论是VRAM还是统一的内存都在你的电脑上。
208When you look at a model, whether it's quantized or not,当你看一个模型, 无论它是否被量化,
209it needs to be able to fit comfortably它需要能够舒适地装配
210within that memory range.在那个记忆范围内
211So if you have 32 gigabytes of VRAM所以,如果你有32千兆字节 VRAM
212and a model is 25 gigs, that's fine.一个模型是25个工作,没关系。
213You'll be able to run it, right?你会运行它,对不对?
214However, one thing to keep in mind with memory不过,有一件事要记住
215is also the speed of the memory.也是内存的速度。
216So while you will be able to run much larger models所以当你可以运行 更大的模型
217on things like modern Macs that have 128 gigabytes在像现代Macs这样的 有128千兆字节的东西上
218of unified memory, the inference speed of those models这些模型的推论速度
219is gonna be much slower than a similar model比一个类似的模型慢得多
220that's running on something like a dedicated GPU运行在像一个专用GPU的东西上
221或Nvidia RTX GPU. (中文(简体) ).
222The reason for this is the speed of the memory.其原因是记忆的速度.
223So while the memory will dictate the size of the model所以虽然记忆会决定模型的大小
224and the more memory you have,越多的记忆,
225the smarter models you can run,你能够运行的更聪明的模型,
226the memory speed matters for the tokens per second每秒符号的内存速度很重要
227and the inference speed that you're going to be able和推论速度 你将有能力
228to generate.生成。
229There's a lot of different techniques here这里有很多不同的技术
230and things that I could get into,和我可以进入的东西,
231but generally speaking,但总的来说,
232if we talk about dedicated graphics cards,如果我们谈论专用显卡,
233again, typically in the Nvidia family,通常在恩维迪亚家族,
234these are much faster, sometimes two or three times faster速度快得多 有时快两三倍
235at inference speed, but they usually have less capacity.在推论速度上, 但他们通常能力较低。
236So for example, I have 24 gigabytes of VRAM in my 4090比如,我4090年有24千兆字节的VRAM
237and it's very fast and can generate 200 tokens per second它的速度很快,每秒能产生200个令牌
238for some of the models that I run.我运行的一些模型。
239However, I can't run models that are 70 billion parameters但我不能运行700亿参数的模型
240like I might be able to on my Mac.碞钩ии沉
241However, on my Mac, those models are really slow然而,在我的Mac上,这些模型真的很慢
242because the memory speed is significantly slower.因为内存速度明显较慢.
243So you're going to be looking at memory speed所以你要看记忆速度
244as well as memory capacity.以及记忆能力。
245Those are the two things that are going to dictate这些是两件事要决定的
246what you can do with local AI.你对本地的AI能做什么?
247And there's always going to be a trade-off总是有取舍
248in terms of the size of the model从模型的大小来看
249and the inference speeds that you're getting.和你的推论速度。
250Typically smaller models are going to be much faster.通常较小的模型会更快
251And again, the most important thing再说一遍,最重要的是
252is that whatever model you run,是无论你运行的模型,
253it needs to fit in this memory它需要融入这个记忆
254while it still can run if it's not in there,如果里面没有它 还能运行
255it's going to be so slow that it's practically unusable.速度会太慢 以至于无法使用
256Generally speaking, if you're looking at models一般来说,如果你在看模特儿
257between 14 and 35 billion parameters,140亿至350亿参数之间,
258those are going to be a really good sweet spot.这将是一个非常好的甜点。
259They're going to give you pretty decent performance他们会给你一个很好的表演
260and you're not going to feel你不会觉得
261like you're missing out on too much.就像你错过了太多。
262If you go up to huge models,如果你去大模型,
263like 120 billion parameters, 250 billion parameters,比如1200亿参数,2500亿参数,
264you're talking about needing extremely high-end hardware你说的是需要非常高端的硬件
265running at slow inference speeds.以缓慢推论速度运行。
266And it's very difficult to actually run those很难真正运行这些
267at scale on your own machine.在自己的机器上。
268Anyways, with that in mind, let's keep going here.无论如何,考虑到这一点, 让我们继续在这里。
269I want to tell you about something really interesting.我想告诉你一些有趣的事
270Now the whole reason you'd even bother现在的整个原因 你甚至会烦恼
271running models locally comes down to one main thing,本地运行的模型 归根结底是一件事,
272which I know you all want, which is control.我知道你们都想要的 这就是控制
273You pick the model, you own the setup你选模特儿,你自有一套
274and nobody can change the deal in.没有人可以改变交易。
275But here's the problem, right?但问题是,对吧?
276Almost every tool that you'd actually want to use几乎每个工具 你真正想要使用
277locks you into one provider's model.把你锁在一个供应商的模型里
278Now that's exactly what Mindhub Cowork,这正是明德胡布同事
279who's the sponsor of today's video, is built to fix.谁是今天录影带的赞助商 是用来修复的
280Now it's open source, free to use,现在它是开源,自由使用,
281and it has a real model router.它有一个真正的模型路由器。
282你可以经营Claw、GPT、Chaminade、Jeepseq
283or the same local models that I've been talking about或者我一直在谈论的本地模特儿
284right here, all inside of this workspace.在这里,所有在这个工作空间内部。
285So the workflow is simple.所以工作流程很简单。
286You brief the built-in agent harness, which is Anton,你向内置特工介绍一下 也就是安东
287walk away and come back to finished work.走开,回来完成工作。
288Now I asked it to research the latest coding models现在我要求它研究最新的编码模型
289and build me a comparison dashboard.帮我造一个比较仪表板
290And this is what it came back with,这就是它回来的原因
291an actual dashboard that I can open and share,一个真正的仪表板 我可以打开和分享,
292not just a wall of text.不只是文字墙。
293And this is the part that connects这是连接的部分
294to everything in this video.给这段录像里的所有内容
295When a better model drops,当一个更好的模型下降,
296whether it's local or a cloud model,无论是本地还是云型
297I can swap it in and I don't have to change anything.我可以把它换进去,我不需要改变任何东西。
298So I have the same workspace, the same work,所以我有相同的工作空间,相同的工作,
299and since it's fully open source,既然它完全开源
300you can clone the repo,你可以复制Repo,
301spin it up locally in just a few commands,转动到局部 仅几个命令,
302or just download the dedicated Mac or Windows app.或者只下载专用的Mac或Windows应用程序.
303The whole thing runs on your own hardware,整个事情运行在你的硬件上,
304which is basically the end game这基本上是结束游戏
305of what we're testing today.今天的测试
306Now they also have a hosted version,现在,他们还有一个主机版本,
307but honestly, I love the desktop app但老实说,我喜欢桌面应用
308as it's very easy to use.因为它很容易使用。
309So I'm gonna leave a link to it in the description.所以我要在描述中留下一个链接。
310Try it out.试试看
311Again, it really goes nicely with these local models.再一次,它真的 与这些当地模型。
312And now let me show you现在让我告诉你
313how we can actually run local models.如何实际运行本地模型。
314So there's a lot of ways to run a local model.因此当地模式的运行方式很多.
315And just like anything in software,就像软件里的任何东西一样
316it really comes down to how much control you want.这真的取决于你想控制多少
317So I've broken this into four different tiers.所以我把它分为四层。
318Now at the top, we've got LM Studio.现在最上面的是LM工作室
319This is a regular desktop app.这是普通的桌面应用程序 。
320You can click, you can download, you can touch everything,你可以点击,你可以下载, 你可以触摸一切,
321and you don't really need to go into the terminal.而你真的不需要进入终端。
322Now below that, we have Olamo.下面是奥拉莫
323This is a really popular option, especially for developers,这是一个非常流行的选择, 特别是对开发者来说,
324and it's just one command inside of your terminal它只是一个命令 在你的终端内部
325where you can talk with models, spin up a local server.您可以与模型交谈, 旋转本地服务器。
326You get the idea.你得到这个想法。
327然后我们有了Docker Model Runner。
328Now this is really good现在,这是真的好
329because it treats models like containers,因为它对待模型 像容器,
330which is perfect if you're actually gonna be deploying如果你真的要部署,那就完美了
331these alongside live applications.它们与现场应用同时存在。
332And at the bottom of my list here, we have full code.在我的名单底部, 我们有完整的代码。
333This is where you're running a model in pure Python这就是你运行一个模型 在纯Python
334and you see every single piece.你可以看到每一块。
335Now, no matter which way you wanna run these models here,现在,不管你想用哪种方式运行这些模型,
336you're gonna be making three decisions.你会做出三个决定
337You're gonna pick a model,你要选一个模特儿
338you're gonna pick a size and quantization你会选择一个大小和量化
339that fits inside of your memory,这符合你的记忆,
340and you're gonna decide how you wanna talk to it.你要决定怎么跟它说话
341So whether that's a chat window or something like code.所以,无论这是一个聊天窗口 还是类似代码的东西。
342If you keep that in mind,如果你记住这一点,
343every single one of these tools is gonna make sense.这些工具中的每一个都会有意义
344So let's start at the top.故从上起.
345And again, I'm gonna go through all of them再说一遍,我要翻遍他们所有
346and show you exactly how to run local models.告诉你如何运行本地的模型。
347Let's dive in.让我们潜入。
348So the first tool on my list here is LM Studio.我的第一个工具是LM工作室。
349I'll give you a quick walkthrough,我给你一个快速的走过,
350but this is one of the best ways to run local models.但这是管理本地模型的最佳方法之一
351Now, once you download the tool again, it's completely free,现在,一旦你再次下载工具, 它是完全免费的,
352you're gonna be brought into a view你会被带入风景
353that looks something like this.看起来像这样
354From here, you're gonna go into the model view,从这里开始,你会进入模型视图,
355looks like kind of a robot icon on the left-hand side,看起来像是左边的机器人图标
356and you'll be able to search你就可以去寻找
357through all of the available models通过所有可用的模式
358that you can download directly here.您可以在此直接下载。
359Now, what you'll wanna do is search for a model现在,你想做的是寻找一个模型
360that matches the kind of relative size匹配相对大小的类型
361or amount of memory that you have.或你的记忆量
362Again, if we're talking about larger high-end machines,再说一遍 如果我们说的是更大的高端机器
363you can typically get away with 27 billion, 35,你通常能逃出270亿 35亿
36430 billion parameters, et cetera.三百亿参数等.
365If you have eight gigs of RAM or 16 gigs of RAM,如果你有8个工作 或16个工作 RAM,
366look for ones that are eight billion parameters寻找80亿的参数
367or four billion parameters, much smaller sizes.或40亿参数,大小小得多。
368So for example, we have Gwen 3.8.例如,我们有格温3.8。
369You'll notice that if I click on this,你会注意到,如果我点击这个,
370I can view different levels of quantization我可以看到不同层次的量化
371and see the change in size right here.看这里大小的变化
372You also see kind of some icons or indications您还看到一些图标或指示
373of which model is the best for you based on your hardware.根据你的硬件,哪个型号最适合你。
374So you can see when it says full GPU offload possible所以你可以看到,当它说全GPU卸载的可能性
375and a little thumbs up,并竖起一小拇指,
376that's the one that you would wanna go with.那是你想去的那个
377And notice this number of Q4,注意这个Q4的号码
378that's the level of precision or the quantization level.这是精确度或量化度。
379So the lower, so like Q4, Q2, Q1,所以越低,就像Q4,Q2,Q1,
380the more quantization you have, right?越多的量化,对不对?
381So if you have Q8, you can see this is bigger所以,如果你有Q8,你可以看到 这是更大的
382than Q6 or Q4, and it's a pretty drastic difference.比Q6或Q4, 这是一个相当巨大的差异。
383You're also gonna wanna look at the capabilities,你也想看看他们的能力
384so vision, tool use, reasoning.因此,视觉,工具的使用,推理。
385If you need it to be able to analyze images, you need vision.如果需要它才能分析图像,就需要视觉.
386If you want it to work in an agentic harness如果你想让它在 代理化的绳子上工作
387or an agent mode, you need tool calling.或代理模式,您需要工具呼叫。
388Hopefully you get the idea.希望你知道这个主意
389There's so many models,这么多模特儿
390I can't possibly go through all of them,我不可能通过他们所有的,
391but you get the idea you can browse through here但你有这个想法 你可以浏览这里
392and look at the ones that are going to match看看那些会匹配的
393your specific hardware and the sizes that make sense.您的特定硬件和大小 合理。
394Now, once you download the model,现在,一旦你下载模型,
395you can view your models from the model tab right here.您可以在这里查看模型标签。
396Now, in order to use these models,现在,为了使用这些模型,
397you do need to load them.你确实需要加载它们。
398So if I select a model like Gemma 4,所以如果我选一个像Gemma4的模特儿
399and I just bring open this sidebar here,我只是把这个侧柱打开,
400it will give me some options for actually loading它会给我一些选项 实际加载
401and running my model.和运行我的模型。
402So what I may wanna do here is go to the load tab所以,我想在这里做的是 去负载标签
403and start changing some of the values.并开始改变一些值。
404If you're a beginner, don't change anything如果你是初学者,不要改变任何东西
405and just run this directly.然后直接运行这个。
406The one thing you can't have a look at只有一件事你无法看
407is the context size here.这里为上下文大小。
408And keep in mind, the larger you make this context size,记住,你做的这个背景尺寸越大,
409the more room is gonna be taken up in your computer's memory在你的电脑记忆中,会占用更多的房间
410because all of this context needs to actually fit因为所有这些背景都需要实际适应
411in the GPU memory, right?在GPU的记忆,对不对?
412Or the memory that you have for running local models.或者你运行本地模型的记忆。
413There's a bunch of other settings you can use,还有一堆其他的设置你可以使用,
414but in this case,但在这种情况下,
415what we're gonna do is just load the model.我们要做的就是装上模型
416Now, when we load the model,现在,当我们加载模型,
417same thing it asks us for the settings.同样的东西 它要求我们设置。
418We're gonna go ahead and load that.我们要继续装货
419It will take a second,需要一点时间
420and then we will be able to view that here然后我们可以在这里看到
421from this terminal view从此终端视图
422and also chat with it directly from the chat window.还直接从聊天窗口与它聊天。
423You can load multiple models at once,你可以马上装上多个模型,
424and you'll be able to see the models that are loaded up here你会看到装满的模型
425as well as the size and then to check them.还有大小 然后检查一下
426So you can see that I'm currently using 5.58 gigabytes所以,你可以看到,我目前使用5.58千兆字节
427of the 63 gigabytes of RAM that I have.我拥有63千兆字节的RAM
428However, we're talking about GPU memory here,但是,我们说的是GPU的记忆,
429so that's not really 100% accurate.所以这不是真的100%准确。
430So if we go here to the terminal,如果我们到终点站
431we can now see that this model is loaded.我们现在可以看到这个模型已经装满了。
432I can view all of the API stuff for this我可以看所有API的东西
433in case I'm a developer and I wanna directly chat with it以防我是开发商 我想直接和它聊天
434using something like a curl command.使用类似卷曲命令。
435If that doesn't make sense to you, don't worry.如果你觉得不合理 别担心
436If you just wanna chat with the model,如果你想和模特儿谈谈
437you can go over to the chat view.你可以去聊天视图。
438So from here, we'll press new chat.因此,从这里,我们将按新的聊天。
439We're just gonna select the model that's already loaded.我们只是要选择 已经上膛的模型。
440因此谷歌Gemma 4.
441We can modify things here, for example,我们可以在这里修改,比如,
442like the system prompt if we wanna do that.如果我们想这么做 系统就会启动
443And then we can just start chatting directly with the model然后我们就可以直接和模型聊天了
444just like we would inside of something like chat GPT.就像我们在里面 喜欢聊天GPT。
445Now you can see this one is extremely fast, right?现在你可以看到这个非常快,对不对?
446We're getting 120 tokens per second我们每秒得到120个金币
447because it's very small.因为它很小。
448And again, I have high memory bandwidth再说一遍,我的记忆带宽很高
449because I'm using a dedicated GPU.因为我在使用专用的GPU.
450You can load multiple models您可以装入多个模型
451as long as they all fit into the memory here.只要他们都融入这里的记忆
452And then again, you can adjust all of the parameters.然后,你可以调整所有参数。
453And if you want to, you can start using them如果你想,你可以开始使用它们
454from this server, which is useful, especially for coding.来自此服务器, 特别是用于编码 。
455And you can see the full logs of everything that's gone on,你可以看到所有事情的完整记录
456tokens per second speed.每秒速度的符号。
457You get the idea.你得到这个想法。
458LM Studio is very good.LM工作室非常不错.
459There's a lot you can do with it.诸法无量.
460And if you want a full tutorial,如果你想要一个完整的教程,
461leave a comment down below and I will go into it.下面留点意见,我再谈
462So the next tool on my list here is Olama.我名单上的下一个工具是奥拉玛。
463Now this is a little bit more popular for developers这对开发者来说更受欢迎
464它和LM Studio有很相似之处
465However, it's a little bit less visual然而,它有点少视觉
466and gives you a bit less control.让你少点控制力
467Now Olama is a very popular way for downloading现在奥拉玛是一个非常流行的下载方式
468and running local models.并运行本地模型。
469In order to use it, you do need to download the tool.为了使用,您确实需要下载工具.
470所以你可以直接去olama.com
471and it will be available inside of your terminal在你的终端里可以找到它
472as a command.作为命令。
473So if you type Olama in your terminal once it's downloaded,所以,如果你打 奥拉玛在你的终端 一旦下载,
474sorry, you should see something like this对不起,你应该看看这样的东西
475where you can launch it for all kinds of tools在那里你可以推出它 各种工具
476or you can directly chat with different models.或者你可以直接和不同的模型聊天。
477Now, as well as the terminal or CLI based tool,以及终端或基于CLI的工具
478there is also a visual tool that you can open还有一个可以打开的视觉工具
479when you download the desktop application.当您下载桌面应用程序时。
480From here again, you can launch Olama再来一次,你可以发射奥拉玛
481inside of any of these harnesses在任何这些绳子里面
482and use models that you've downloaded.并使用你下载过的模型。
483You can go into the settings, right?你可以进入环境,对不对?
484Or you can actually just start chatting或者你可以开始聊天
485with different models by selecting one通过选择一个来使用不同的模型
486of the ones that you have.你拥有的。
487Now, in order to download models in Olama,现在 为了在奥拉玛下载模型
488what you're gonna do is start by finding the model你要做的是从找到模型开始
489that you want.说你想说的
490So you're gonna have to go to the Olama hub.所以你得去奥拉玛中心
491So by doing that, you can go Olama and then Models.因此,通过这样做,你可以去奥拉玛和模型。
492From here, there's a bunch of models从这里,有一群模特
493that are available for Olama.给奥拉玛的
494Same thing, you can search through them.同样的事情,你可以搜索 通过他们。
495You can ask ChatGBT to help you find one.你可以请ChatGBT帮助你找到一个.
496And if you find a model that you want,如果你找到一个你想要的模型,
497so actually let's go maybe NemoTron 3.5 Lightning here,因此,实际上让我们去 也许尼莫特龙3.5闪电在这里,
498we can see all the different sizes.我们可以看到所有不同的尺寸。
499We now understand what B stands for我们现在明白B代表什么
500and what quantization is, right?而什么是量化,对不对?
501So we can have a look at them here好让我们看看这里
502and we can pull them directly inside of Olama.我们可以直接把他们拉进奥拉玛
503So the way this works is the following.因此,这个方法是:
504First, you can type Olama list.首先,你可以输入奥拉玛列表.
505If you type list, this will show you all the models如果您输入列表, 这将显示所有模型
506you currently have downloaded.您已下载 。
507And then if you wanna pull a model, you'll type Olama pull然后,如果你想拉一个模型, 你会打奥拉玛拉
508and then the model ID that you found from the model hub.然后从模型中心找到的模型ID。
509This is gonna download it to your computer这个会下载到你的电脑上
510and then allow you to start using it.然后让你开始使用它。
511If you wanna run a model, you can type Olama run如果你想运行一个模型,你可以打 奥拉玛运行
512and then put the model ID.然后把模式ID。
513So I'm gonna put NemoTron 3 like this所以我要把尼莫特龙3这样
514and it will start the model.它会启动模型。
515It will load it into my computer's memory.它会把它装进我电脑的记忆里
516This is why we'll always take a second at the beginning这就是为什么我们总是在开始的时候花一秒钟
517cause it actually needs to load it.因为它实际上需要加载它。
518Then you can start chatting with it那你可以开始跟它聊天了
519directly from this view.直接来自此视图。
520So here you can see, I can type something like hello world所以这里你可以看到,我可以打一些东西 像你好世界
521and I can just directly start using this local model.我可以直接开始使用这个本地模型。
522Now, as well as that, I can do that from this terminal view.现在,还有,我可以从这个终端的角度来做。
523So if I go to, let's go NemoTron nano or something,所以,如果我去, 让我们去尼莫特龙纳米什么的,
524I can type hello.我可以打个招呼。
525Same thing, we need to wait for it to be loaded同样的事情,我们需要等待它被装上
526and then it will give us a response.然后它将给我们一个回应。
527Sometimes it takes a second, especially on the first load有时要花点时间 尤其是第一次
528but you can see we get the thinking但你可以看到 我们得到的想法
529and then we get the response.然后我们得到回应。
530And if we go back here, hello, how can I assist you today?如果我们回到这里,你好,我有什么可以帮助你今天?
531Now this is great,现在,这是伟大的,
532but Olama will also expose all of its services on an API.但奥拉玛也会在API上曝光它的所有服务.
533So for example, if I type Olama help,比如,如果我输入奥拉玛的帮助,
534you're gonna see an option你会看到一个选择
535of all of the different things that you can do.所有不同的事情 你可以做的。
536As long as Olama is running,只要奥拉玛在跑
537it will actually serve all of its models它实际上将服务于它的所有模式
538available on a default port.在默认端口上可用。
539I don't remember exactly what the port is我不记得港口到底是什么
540but I believe it's something like 11,434,但我相信是11,434号
541which means that you're actually able to send curl requests也就是说你实际上可以发出卷曲请求
542and use Olama from other tools并使用其他工具中的Olama
543as long as it's running in the background.只要它运行在背景。
544I'm not gonna go into a full tutorial of it我不会去一个完整的辅导它
545but if you're a developer and you understand但如果你是一个开发者 你明白
546what a REST API is,何等为雷斯特API,
547Olama provides that already with access奥拉玛已经提供 已经进入
548to all of the models.给所有的模型。
549It will automatically load any model that you ask it for它会自动加载任何您想要的模型
550whenever you try to send a request to it.当你试图向它发出一个请求。
551It actually has what's called an OpenAI compatible API它实际上有所谓的OpenAI兼容API
552which means that you will be able to send requests这意味着您将可以发送请求
553in the same format that you would格式与您将采用的格式相同
554像ChatGBT或者Anthropic之类的
555Anyways, that is Olama.总之,那是奥拉玛。
556Let's go to the next example.复次举譬.
557So the next tool on my list here is the Docker Model Runner.我名单上的下一个工具是Docker模型运行器。
558Now this is available as an experimental feature现在这个是实验性的
559在 Docker 桌面内。
560There is a bunch of restrictions with it.有很多限制。
561However, if you are gonna be doing this但是,如果你要这样做
562在 Linux 机器上
563and you have Nvidia hardware, it works very well.你有Nvidia的硬件, 它的工作非常好。
564It can work on CPU as well, I believe,CPU也有用,我相信,
565however, it's extremely slow.然而,这是极其缓慢的.
566So with Docker Model Runner,因此,与多克模型运行者,
567if you go into Docker desktop, there is some settings如果您进入 Docker 桌面, 有些设置
568I believe you need to enable this experimental feature.我相信你需要启用这个实验功能。
569You should see this Models tab.你应该看看这个模型标签。
570From the Models tab, you'll be able to go to Docker Hub从模型标签,你可以去Docker枢纽
571and then here you can pull all of the same type of models然后在这里,你可以拉 所有相同的型号
572as you would be able to inside of like Olama or LM Studio.就像奥拉玛或LM工作室
573Once you have a model here, you can chat with it directly.一旦你有一个模型在这里,你可以直接与它聊天.
574So I have Gemma 3, for example,所以我有Gemma 3,例如,
575same thing, it will automatically load the model for me.同样的,它会自动加载模型给我。
576And then I can type something like hello.然后我可以打一个像你好的东西。
577Now, similarly to all of the other tools,现在,和所有其他工具一样,
578this will also expose a REST API on a different port.这也将会在不同的端口暴露一个REST API.
579I believe it's 12,434 or 343我想是12,434或343个
580that will allow you the ability to chat with these models这样你就能和这些模型聊天
581without being directly inside of this interface.而不直接在此界面内。
582You can also inspect the model,你也可以检查模型,
583see all the information about it, et cetera.见一切诸法等.
584What's interesting about the Docker Model RunnerDocker模型运行器有什么有趣的
585is that it actually treats models like containers.实际上它把模型当成容器
586What that means is that you can write Docker files,这意味着你可以写Docker文件,
587you can write compose files,你可以写作曲文件,
588and you can actually have models shipped directly也可以直接运出模型
589with your applications and be dependencies exposed与您的应用程序并暴露依赖关系
590through Docker kind of services,通过多克的服务,
591which is a lot more complicated这要复杂得多
592than I'm going to get into in this video.而不是我要进入这视频。
593But if you do use Docker and you're familiar with this但是如果你真的用Docker 你熟悉这个
594and you use it for your apps and you want local models,你用它来做你的应用 你需要本地的模型,
595this is a really good way to deploy them.这是部署他们的好办法
596Now, I'll also show you that there is a CLI based tool.现在,我还要告诉你,有一个基于CLI的工具.
597So similarly to what we had before,跟我们以前一样
598if I type something like Docker model,如果我输入的东西 像Docker模型,
599you can see that we can configure,你可以看到,我们可以配置,
600inspect, install the runner, push RM,检查,安装跑者,推RM,
601view the models, load, unload.查看模型,装货,卸货。
602You guys get the idea你们知道这个主意
603and you can view models directly inside of here as well.也可以直接在这里查看模型
604So this is a really powerful feature.这是一个非常强大的特征。
605And if you want a full tutorial on it,如果你想要一个完整的辅导,
606I have actually done that on my channel.我确实在我的频道上做了
607You can see the easiest way to run LM's locally,你可以看到最简单的方法 运行本地的LM,
608Docker Model Runner tutorial,Docker 模型运行器教程,
609goes through all of the features通过所有的特性
610and we'll even show you all of the Docker files我们甚至会给你们看所有的Docker文件
611and how to set it up with the automatic deployment.和如何设置它与自动部署。
612好吧,这是Model Runner。
613Now let's move to the last one, which is full code.现在,让我们移动到最后一个, 这是完整的代码。
614Okay, so the last example I have for you好,我给你的最后一个例子
615is actually running models using just code.正在使用简单的代码运行模型。
616So this means that we're actually gonna bring所以这意味着我们真的会带来
617in our own inference engine, in this case, Llama CPP,在我们自己的推论引擎中, 在本案中,Llama CPP,
618and not rely on something like Olama而不是依赖象奥拉玛一样的东西
619或者Docker Model Runner 或者LM Studio来为我们做这个
620Now, the big surprise is that Llama CPP is the engine现在,最大的惊喜是Llama CPP是引擎
621that pretty much all of the tools that we just looked at几乎所有的工具 我们刚刚看
622are already using,已经在使用,
623but if we want to invoke it directly ourself,但如果我们想直接援引它,
624we can do that.我们可以做到这一点。
625So for example, you'll see we have this Gwen 2.5 model,比如说,你会看到我们有Gwen 2.5模型
626which I've downloaded locally on my computer.我从电脑上下载的
627Again, this is literally just a file再说一遍,这只是一个文件
628that contains a bunch of numbers.里面有一堆数字
629Now, if I want to run this,现在,如果我想运行这个,
630normally I would need a Llama or something like that,通常我需要拉玛之类的东西
631but I can actually write code但我可以写代码
632that will invoke it directly for me.它会直接为我引用它。
633So you'll see that I can just load the model.所以你会看到,我可以只是装上模型。
634I can then create a response using this package.然后,我可以用这个软件包创建一个响应。
635And if I just run the code here,如果我在这里运行密码
636you will see that I get the following.你会看到,我得到以下。
637In my heart, I run AI on my desk running free,在我的心里,我运行AI在我的桌子上 免费运行,
638and it wrote me write a haiku or whatever you call this它写我写一个海库 或任何你所谓的这个
639about running AI on your own computer.关于运行AI 在自己的计算机。
640Now I can change this prompt to be,现在我可以改变这个速度,
641hey, who is Tim or something?嘿,谁是蒂姆什么的?
642I don't know if that's gonna give us anything meaningful,我不知道这会不会给我们带来什么意义
643but let's run this.但让我们运行这个。
644And Tim is a character from a popular video game,蒂姆是一个流行电子游戏的人物
645whatever, right?随便吧?
646So this is a very small model.这是一个很小的模型。
647Of course, it's not gonna give us good responses,当然,它不会给我们好的答复,
648but you get the idea.但你明白这个想法
649We can run it fully locally.我们可以完全在当地运行。
650Now, one thing to keep in mind is that as well as doing this,现在,有一件事要记住 除了这样做,
651we can actually chat with models我们可以和模特儿聊天
652that are running on our own computer正在我们自己的电脑上运行
653through services like a Llama.像Llama这样的服务。
654So like I was mentioning,就像我刚才提到的那样
655if a Llama is installed and running,如果一个Llama安装和运行,
656you can specify the model that's actually available您可以指定实际可用的模型
657在你下载的Llama。
658And then similarly to before,跟以前一样
659I can run something like this.我可以运行这样的东西。
660In this case, it's gonna be a bit slower这样的话,会慢一点
661because Llama 2 is much larger.因为Llama 2是更大的。
662And you'll see that we actually get the response, right?你会看到,我们实际上得到了回应,对不对?
663And it says, hey,它说,嘿,
664someone might choose to run an AI model locally,有人可能会选择在当地运行一个AI模型,
665blah.
666And it's using that a Llama backend service.它使用Llama后端服务。
667And if I wanted to,如果我想的话,
668I could even change this to the LLM API, right?我甚至可以把它改成LLM API,对不对?
669或 LM Studio API 或 Docker 模型运行器 API
670and do the exact same thing right from code.并做同样的事情 从代码。
671So this is kind of the more manual method,所以,这是一种 更手工的方法,
672but most developers are gonna end up managing their models但大多数开发者最终会管理他们的模型
673through something like a Llama.穿过像Llama的东西。
674And then invoking them in code using a method like this.然后用这种方法在代码中引用它们。
675Okay, so that wraps up the demos.好吧,这样就结束了演示。
676Now let's talk about which method you should actually use.现在我们来谈谈你应该使用哪种方法。
677So here's my honest take.所以,这是我诚实的拍摄。
678If you just wanna chat with the model如果你想和模特儿谈谈
679and you never wanna see a terminal,你从不希望看到一个终端,
680then you can use something like LM Studio.这样你就可以用LM工作室了
681It's genuinely one of the easiest ways to download models这是最容易下载模型的方法之一
682and has some of the most amount of features.并且拥有一些数量最多的特征.
683If you're a developer and you want a model如果你是开发商 想要一个模型
684running on your own machine在自己的机器上运行
685that your scripts and apps can talk to,你的剧本和应用程序可以说话,
686definitely use a Llama.绝对要用拉玛
687That's what I reach for most days大部分时间我都是这样
688and it works really well locally.并且它在当地非常有效。
689If you're already living inside of a Docker container如果你已经住在多克容器里
690and you want models sitting in that stack right next to you,你想让模特坐在你旁边
691然后使用Docker Model Runner,对吗?
692It's really good in production生产真的很好
693if you're actually building and deploying things out.如果你真的在建造和部署东西。
694And lastly, if you wanna understand最后,如果你想了解的话
695everything that you're doing and run models yourself你所做的一切,你自己经营模特
696in probably the most efficient way,也许是最有效的方式,
697then you can use your own code to do so.那样你就可以用你自己的代码了
698Of course, you don't need to use Python.当然,你不需要使用Python。
699This is just a quick example.这只是一个简单的例子。
700And with that in mind, just remember记住这一点,只要记住
701that all of these tools at the end of the day最后这些工具
702are using the same building blocks使用相同的组件
703that we talked about earlier.我们之前说过的
704They have a model, which again,他们有一个模型,再次,
705is literally just a bunch of numbers in a file字面上只是文件里的一堆数字
706and they have an inference engine他们有一个推论引擎,
707and a bunch of other fancy features on top of it.上面还有一堆其他的花样
708If you understand that, you understand local models如果你明白这一点,你就明白本地的模型
709and hopefully this video helped get you off the ground希望这段视频能帮助你脱身
710and running your first one on your own device.然后用自己的设备运行第一个
711Anyways, guys, that's all that I have for you.总之,伙计们,我只有这些了
712If you enjoyed, make sure to leave a like, subscribe,如果你喜欢, 确保离开类似,订阅,
713and I will see you in the next one.我会看到你在下一个。
714See you next time.下次见
715Bye!再见!
该视频共有字幕 715 条。解锁更多字幕为会员功能,请移动到 价格

P3 · 【本地AI】手把手教你在电脑上跑AI模型 · 零基础指南 p03 无字幕 (P3)

字幕摘录

时间英文中文
0:00Everybody is talking about running AI locally,大家都在谈论本地的人工智能
0:03but almost nobody explains what it is但几乎没人解释是什么
0:05or how you actually get it to work.或者你如何真正让它工作。
0:07Now you get these videos where people throw around terms现在,你得到这些视频 人们扔周围的条件
0:09like weights or quantization, you know, VRAM, GGUF,如重量或量化, 你知道,VRAM,GGUF,
0:13and it sounds like you need a PhD听起来你需要博士学位
0:15and a $10,000 computer just to try this out.和一万块的电脑 只是试试这个。
0:18And that's exactly why most people give up这就是为什么大多数人放弃
0:20and just keep paying for subscriptions like ChatGPT.继续支付像ChatGPT这样的订阅费.
0:23So let me give you the honest one sentence version here.所以,让我给你一个诚实的句子。
展开字幕全文(710 条)
序号英文中文
1Everybody is talking about running AI locally,大家都在谈论本地的人工智能
2but almost nobody explains what it is但几乎没人解释是什么
3or how you actually get it to work.或者你如何真正让它工作。
4Now you get these videos where people throw around terms现在,你得到这些视频 人们扔周围的条件
5like weights or quantization, you know, VRAM, GGUF,如重量或量化, 你知道,VRAM,GGUF,
6and it sounds like you need a PhD听起来你需要博士学位
7and a $10,000 computer just to try this out.和一万块的电脑 只是试试这个。
8And that's exactly why most people give up这就是为什么大多数人放弃
9and just keep paying for subscriptions like ChatGPT.继续支付像ChatGPT这样的订阅费.
10So let me give you the honest one sentence version here.所以,让我给你一个诚实的句子。
11That is that local AI is simply a model file这就是说本地的AI只是一个模型文件
12that's sitting on your computer and a program that runs it.坐在你的电脑和运行程序上
13That's it, no cloud, no API keys,就这样,没有云,没有API键,
14no internet, no subscription.没有互联网,没有订阅。
15Everything else is really just a small detail.其他一切都只是个小细节
16So in this video, I'm gonna break down因此,在这个视频中,我要打破
17what's actually happening under the hood,引擎盖下到底发生了什么
18the real building blocks, and none of the fluff.真正的建筑构件, 和没有绒毛。
19And then I'm gonna show you how to run a model然后我会告诉你如何运行一个模型
20on your own machine in four completely different ways,在你自己的机器上 四种完全不同的方式,
21from an app that you download从您下载的应用程序中
22all the way to pure low-level code一直到纯低层代码
23where you're running it yourself.在那里你运行它自己。
24Now by the end of this video,现在,在这个视频结束时,
25you're gonna understand local AI你会明白本地的AI
26better than most people that are posting about it.比大多数贴报的人要好
27So let's dive in.所以让我们潜入。
28So first, let's clear up先说清楚
29the most common confusion that I see.我所看到的最常见的混乱
30Now that's what's actually different这才是真正的不同
31between something like ChatGPT and a local model.在像ChatGPT之类的东西 和本地模型之间
32Now when you use ChatGPT, Cloud, Gemini,当你使用ChatGPT,云,双子座,
33really any of these tools,任何这些工具,
34what's happening is that you type a message,发生的事情是 你输入一个消息,
35that message leaves your computer,留言留下你的电脑,
36it travels over the internet to something like a data center它在互联网上游历到一个像数据中心的东西
37where a massive computer that you don't own你没有的大型电脑
38runs a giant model, and then the answer运行一个巨大的模型,然后答案
39gets streamed back to your screen.回到屏幕上
40So your computer did basically nothing.所以,你的电脑基本上什么都没做。
41It's really just a window into somebody else's machine.它真的只是一个窗口 进入别人的机器。
42Now local AI completely flips that.现在本地的AI完全推翻了这一点.
43The model, so the actual file模型,所以实际文件
44that contains all of the intelligence,包含所有情报
45gets downloaded onto your computer.下载到电脑上
46And when you ask it a question,当你问这个问题时,
47your own CPU or GPU is the one that's doing the work.您的CPU或GPU是 做这项工作。
48So nothing leaves your machine,所以,没有什么离开你的机器,
49and that gives you three big advantages.这给你三个大优势
50Now first, it's private.现在,首先,这是私人的。
51That's because your data never goes anywhere,那是因为你的数据从不消失
52it stays on your computer.它留在你的电脑上。
53Second, it's free, because there's no subscription第二,这是免费的,因为没有订阅
54and there's no per-token cost.而且没有每桶成本。
55And lastly, it works offline.最后,它的工作离线。
56So if you're in a plane or a coffee shop with terrible Wi-Fi,所以,如果你在飞机或咖啡店 用可怕的无线,
57doesn't matter, you can use these local models.无所谓,你可以使用这些本地模型。
58Now I do wanna be honest here about the trade-offs,现在,我想诚实地在这里 关于权衡,
59which is that the models that you're gonna be able也就是你能够做的模型
60to run at home are much smaller than the frontier models在家跑步比边疆模式要小得多
61that you'd use from something like Cloud or OpenAI.你会用在云或OpenAI之类的东西上
62But they have gone shockingly good但是,他们已经走了惊人的好
63over the last couple of years,在过去几年里,
64and for a huge amount of everyday tasks,和大量日常工作,
65even coding tasks, they're more than enough.甚至编码任务,它们都足够了。
66So with that said, let's have a look所以说,让我们来看看
67at the actual pieces here,在实际的作品在这里,
68so you understand local models much deeper.所以你更了解当地的模型
69Now the first part here is the model itself.现在第一部分是模型本身。
70And I wanna be really clear about what a model actually is,我想说清楚什么是模特儿
71because this is where some people imagine因为这就是一些人想象的
72some kind of magic black box.某种魔力黑盒。
73Now a model is literally just a file.现在一个模型其实只是一个文件。
74It's a really big file, could be hundreds of gigabytes,这是一个非常大的文件,可能是数百千兆字节,
75that's full of numbers that we call weights.我们称之为重量数
76Now these are billions of numbers这些是数十亿的数字
77that got baked in when the model was trained.当模特被训练时 被烤熟了
78Now that file doesn't think, it doesn't run,现在那个文件不思考,它不运行,
79it just sits there on your disk它只是坐在你的磁盘上
80like any other file that you would have.就像其他文件一样
81And companies like Meta, Google, Alibaba, Mistral, whatever,还有梅塔、谷歌、阿里巴巴、米斯特拉尔等公司
82they release these files for free.他们免费发布这些文件。
83Now those are your open models这些是你的公开模型
84and things that you keep hearing about和你们所听到的
85比如Llama或者Gemma或者Quen或者DeepSeq,你懂这个意思.
86You can literally just download them你可以直接下载
87because they are literally just a file因为从字面上来说,它们只是一个文件
88full of billions of different numbers.充满了数十亿个不同的数字。
89Now when you go to look at these models,当你去看这些模型时,
90you're gonna see names like four billion,你会看到40亿的名字,
91eight billion, 70 billion.八十亿七百亿.
92Now that B is billions,现在B是亿,
93and it stands for the number of parameters.它代表参数的数量。
94Now that's effectively just how many numbers现在,这是有效的 只是多少数字
95are inside of that file.里面的档案。
96And the rule here is pretty simple.这里的规则很简单。
97Generally speaking, more parameters means a smarter model,一般来说,更多的参数意味着一个更聪明的模型,
98but it also means a bigger file但它也意味着一个更大的文件
99that needs more memory and compute to run.这需要更多的记忆和计算运行。
100So if you look at an eight billion model,所以如果你看看80亿的模型
101this is maybe a few gigabytes in storage.这也许是几千兆字节的存储。
102Well, a 70 billion model is a file that's so large嗯,一个700亿的模型是一个文件 这是那么大
103that most laptops simply cannot even load it,大部分笔记本电脑都装不下
104and some may not even have enough storage to download it.而有些人甚至可能没有足够的存储器可以下载.
105Now that leads directly into the biggest trick现在,这直接 进入最大的诡计
106that happens with local AI.这发生在本地AI。
107Now this is something called quantization.这是所谓的量化。
108Now it sounds scary and really complicated,现在听起来很可怕,很复杂
109but it's really the same idea as compressing a photo.但它真的相同的想法 压缩一张照片。
110So you can take these billions of numbers这样你就可以拿这些亿万的数字
111and you can store them with less precision.并且可以更精确地储存它们。
112And that means that this model file这意味着这个模型文件
113is gonna get dramatically smaller就会变小
114with barely any quality loss at all.几乎没有质量损失。
115So a model that would normally need 16 gigabytes of memory所以这个模型通常需要16千兆字节的内存
116in its original form might only need five, six,原型可能只需要五,六,
117or seven gigabytes after quantization.或七千兆字节后
118And when you see the term gguf floating around,当你看到这个术语漂浮,
119that's basically just the standard file format这基本上只是标准文件格式
120for these compressed models.这些压缩模型。
121Now this is the entire reason这才是全部原因
122that normal computers can even run AI models at all,普通电脑甚至可以运行AI模型,
123or at least some of the bigger ones.或至少一些较大的。
124So when you hear about quantization所以,当你听到关于量化
125or a quantized model,或被量化的模型,
126just think of that as a compressed model把这当成一个压缩模型
127that's meant to make it smaller so it's easier to run.意思是让它变小 所以它更容易运行。
128When you compress these models,当你压缩这些模型时,
129you keep almost the exact same performance,你保持几乎完全相同的表现,
130but again, you just reduce the size drastically,再说一次,你只是大大缩小了尺寸
131so it's a lot easier to actually run.因此,这很容易真正运行。
132Now the next piece is the inference engine.现在下一个是推论引擎。
133And this is the part that almost nobody explains.这是几乎没人解释的部分。
134Remember that the model is just a file full of numbers,记住,模型只是一个文件 充满数字,
135and a file can't run itself.并且文件不能自己运行。
136So you need a program所以你需要一个程序
137that can actually load these numbers into memory可以将这些数字装入内存
138and do the actual math to make the model work并做实际的数学 使模型工作
139and predict the next token.并预言下一个迹象。
140Now that program is called an inference engine.现在这个程序叫做推论引擎.
141Now the most famous one is called llama.cpp.现在最著名的一个叫做lama.cpp.
142And here's the secret,这是秘密
143almost every tool that I'm gonna show you today,几乎每一个工具 我今天要给你看,
144so LM Studio, Olamma, Docker Model Runner,因此LM工作室,奥拉姆马,多克模型运行器,
145they're all basically just a wrapper他们基本上都只是一个包装器
146around engines like this.绕着这种引擎
147Now the engine does all of the work,现在引擎完成了所有的工作,
148and the tool just kind of makes it nice to use,而工具只是 那种使它使用,
149which you're gonna see later on.稍后你会看到的。
150Now the last building block here is your hardware,最后一块是你们的硬件
151because there's really only one question因为只有一个问题
152that decides what local models决定何种地方模式
153you're going to be able to run.你会跑的
154Now that is, how much memory do you have on your computer,你电脑里有多少记忆
155and how fast is that memory?记忆有多快?
156Now on a PC with a graphics card,现在在一台带显卡的PC上
157so a dedicated graphics card,所以一个专用的显卡,
158that number is gonna be your VRAM.这个号码会是你的VRAM。
159So if you have an Nvidia 3090 or 4090 or 5090,所以,如果你有一个Nvidia 3090或4090或5090,
160or I'm just naming random GPUs,或者我只是命名随机GPU,
161you're gonna look at the VRAM on that device.你看看那个装置上的VRAM
162Now if you're running on a modern Mac computer,如果你在现代Mac电脑上运行
163就像M3或M4一样 任何M系列的MacBook
164then you're just gonna be looking at the amount of RAM那你就只能看看内存的数量
165that your computer has.你的电脑有。
166And that's because Apple shares its memory with the GPU,这是因为苹果公司与GPU共享其记忆,
167and has something called unified memory.并有所谓的统一记忆。
168Now other devices have different specifications,现在其他设备有不同的规格,
169but generally speaking,但总的来说,
170if you have a relatively new computer,如果你有一个相对新的计算机,
171if it has a dedicated graphics card,如果它有一个专用的图形卡,
172你看着VRAM。
173That's the amount of memory you're gonna have这就是你的记忆量
174for running local models.用于运行本地模型。
175And if you're on a Mac, again, a modern one,如果你在Mac上 又是现代的
176you're looking at the amount of unified memory.你在看统一记忆的量
177And the rule of thumb here is pretty simple.这里的拇指规则很简单。
178The model file needs to be able to fit模型文件需要适合
179inside of that memory that you have在你的记忆中
180with a little bit of room to spare.还有一点空位
181So roughly speaking,所以说,
182if you have eight gigabytes of VRAM or unified memory,如果你有8千兆字节 VRAM 或统一的内存,
183you're gonna be able to run你会跑的
184three to four billion parameter models,三到40亿个参数模型,
185even without being quantized.即使没有被量化。
186And if you have 16 gigabytes of memory,如果你有16千兆字节的记忆
187you can go up to seven or eight billion parameter models.可以达到70或80亿个参数模型。
188And then if you go up to 32 gigabytes,然后如果你升到32千兆字节
189you start to be able to get into你开始可以进入
190the 14 to 30 billion parameter range.140-300亿参数范围。
191And this is where things start to feel genuinely smart,而这就是事情开始 感觉真正聪明,
192especially for local models.特别是当地模特儿
193But keep in mind,但记住,
194you don't need a monster computer to do any of this.你不需要怪物电脑来做这些
195Even with something like your phone,即使是用你的手机一样的东西
196you can run small models already.你可以运行小模型了。
197And one thing that carries over from cloud AI还有从云中传来的一件事
198is that the context windows是上下文窗口
199to the model short-term working memory到模式短期工作记忆
200is going to actually affect the amount of space将会影响空间的大小
201that's being taken up.这正在处理中。
202So if you have long conversations, bigger documents, et cetera,所以,如果你有长话短说, 更大的文件等等,
203that's also going to fill up your memory.那也会让你的记忆充满
204Now I'm gonna explain this a little bit more in detail现在我要详细解释一下
205because this is super important.因为这很重要
206But the basic idea is that the one number但基本想法是,一个数字
207you need to be aware of is how much memory,你需要知道 有多少记忆,
208either VRAM or unified memory, is on your computer.无论是VRAM还是统一的内存,都在你的电脑上。
209When you look at a model, whether it's quantized or not,当你看一个模型, 无论它是否被量化,
210it needs to be able to fit comfortably它需要能够舒适地装配
211within that memory range.在那个记忆范围内
212So if you have 32 gigabytes of VRAM所以,如果你有32千兆字节 VRAM
213and a model is 25 gigs, that's fine.一个模型是25个工作,没关系。
214You'll be able to run it, right?你会运行它,对不对?
215However, one thing to keep in mind with memory不过,有一件事要记住
216is also the speed of the memory.也是内存的速度。
217So while you will be able to run much larger models所以当你可以运行 更大的模型
218on things like modern Macs that have 128 gigabytes在像现代Macs这样的 有128千兆字节的东西上
219of unified memory, the inference speed of those models这些模型的推论速度
220is gonna be much slower than a similar model比一个类似的模型慢得多
221that's running on something like a dedicated GPU运行在像一个专用GPU的东西上
222或Nvidia RTX GPU. (中文(简体) ).
223The reason for this is the speed of the memory.其原因是记忆的速度.
224So while the memory will dictate the size of the model所以虽然记忆会决定模型的大小
225and the more memory you have,越多的记忆,
226the smarter models you can run,你能够运行的更聪明的模型,
227the memory speed matters for the tokens per second每秒符号的内存速度很重要
228and the inference speed和推论速度
229that you're going to be able to generate.你将有能力生成。
230There's a lot of different techniques here这里有很多不同的技术
231and things that I could get into,和我可以进入的东西,
232but generally speaking,但总的来说,
233if we talk about dedicated graphics cards,如果我们谈论专用显卡,
234again, typically in the Nvidia family,通常在恩维迪亚家族,
235these are much faster, sometimes two or three times faster速度快得多 有时快两三倍
236at inference speed, but they usually have less capacity.在推论速度上, 但他们通常能力较低。
237So for example, I have 24 gigabytes of VRAM in my 4090比如,我4090年有24千兆字节的VRAM
238and it's very fast and can generate 200 tokens per second它的速度很快,每秒能产生200个令牌
239for some of the models that I run.我运行的一些模型。
240However, I can't run models that are 70 billion parameters但我不能运行700亿参数的模型
241like I might be able to on my Mac.碞钩ии沉
242However, on my Mac, those models are really slow然而,在我的Mac上,这些模型真的很慢
243because the memory speed is significantly slower.因为内存速度明显较慢.
244So you're going to be looking at memory speed所以你要看记忆速度
245as well as memory capacity.以及记忆能力。
246Those are the two things that are going to dictate这些是两件事要决定的
247what you can do with local AI.你对本地的AI能做什么?
248And there's always going to be a trade-off总是有取舍
249in terms of the size of the model从模型的大小来看
250and the inference speeds that you're getting.和你的推论速度。
251Typically, smaller models are going to be much faster.通常,较小的模型会更快。
252And again, the most important thing再说一遍,最重要的是
253is that whatever model you run,是无论你运行的模型,
254it needs to fit in this memory.它需要融入这个记忆。
255While it still can run if it's not in there,虽然它仍然可以运行,如果它不在那里,
256it's going to be so slow that it's practically unusable.速度会太慢 以至于无法使用
257Generally speaking, if you're looking at models一般来说,如果你在看模特儿
258between 14 and 35 billion parameters,140亿至350亿参数之间,
259those are going to be a really good sweet spot.这将是一个非常好的甜点。
260They're going to give you pretty decent performance他们会给你一个很好的表演
261and you're not going to feel你不会觉得
262like you're missing out on too much.就像你错过了太多。
263If you go up to huge models like 120 billion parameters,如果你达到巨大的模型 像1200亿参数,
264250 billion parameters,2500亿参数,
265you're talking about needing extremely high-end hardware你说的是需要非常高端的硬件
266running at slow inference speeds.以缓慢推论速度运行。
267And it's very difficult to actually run those at scale很难在规模上运行
268on your own machine.在自己的机器上。
269Anyways, with that in mind, let's keep going here.无论如何,考虑到这一点, 让我们继续在这里。
270I want to tell you about something really interesting.我想告诉你一些有趣的事
271Now, the whole reason you'd even bother现在,整个原因 你甚至会烦恼
272running models locally comes down to one main thing,本地运行的模型 归根结底是一件事,
273which I know you all want, which is control.我知道你们都想要的 这就是控制
274You pick the model, you own the setup,你选模特儿,你拥有设定
275and nobody can change the deal in.没有人可以改变交易。
276But here's the problem, right?但问题是,对吧?
277Almost every tool that you'd actually want to use几乎每个工具 你真正想要使用
278locks you into one provider's model.把你锁在一个供应商的模型里
279现在,这正是Mindhub合作,
280who's the sponsor of today's video, is built to fix.谁是今天录影带的赞助商 是用来修复的
281Now, it's open source, free to use,现在,它是开源的,自由使用,
282and it has a real model router.它有一个真正的模型路由器。
283你可以经营Claw、GPT、Chaminade、Jeepseq
284or the same local models that I've been talking about或者我一直在谈论的本地模特儿
285right here, all inside of this workspace.在这里,所有在这个工作空间内部。
286So the workflow is simple.所以工作流程很简单。
287You brief the built-in agent harness, which is Anton,你向内置特工介绍一下 也就是安东
288walk away, and come back to finished work.走开,回来完成工作。
289Now, I asked it to research the latest coding models现在,我要求它研究最新的编码模型
290and build me a comparison dashboard.帮我造一个比较仪表板
291And this is what it came back with,这就是它回来的原因
292an actual dashboard that I can open and share,一个真正的仪表板 我可以打开和分享,
293not just a wall of text.不只是文字墙。
294And this is the part that connects这是连接的部分
295to everything in this video.给这段录像里的所有内容
296When a better model drops,当一个更好的模型下降,
297whether it's local or a cloud model,无论是本地还是云型
298I can swap it in and I don't have to change anything.我可以把它换进去,我不需要改变任何东西。
299So I have the same workspace, the same work,所以我有相同的工作空间,相同的工作,
300and since it's fully open source,既然它完全开源
301you can clone the repo,你可以复制Repo,
302spin it up locally in just a few commands,转动到局部 仅几个命令,
303or just download the dedicated Mac or Windows app.或者只下载专用的Mac或Windows应用程序.
304The whole thing runs on your own hardware,整个事情运行在你的硬件上,
305which is basically the end game这基本上是结束游戏
306of what we're testing today.今天的测试
307Now, they also have a hosted version,现在,他们还有一个主机版本,
308but honestly, I love the desktop app但老实说,我喜欢桌面应用
309as it's very easy to use.因为它很容易使用。
310So I'm gonna leave a link to it in the description.所以我要在描述中留下一个链接。
311Try it out.试试看
312Again, it really goes nicely with these local models.再一次,它真的 与这些当地模型。
313And now, let me show you现在,让我告诉你
314how we can actually run local models.如何实际运行本地模型。
315So there's a lot of ways to run a local model.因此当地模式的运行方式很多.
316And just like anything in software,就像软件里的任何东西一样
317it really comes down to how much control you want.这真的取决于你想控制多少
318So I've broken this into four different tiers.所以我把它分为四层。
319Now at the top, we've got LM Studio.现在最上面的是LM工作室
320This is a regular desktop app.这是普通的桌面应用程序 。
321You can click, you can download, you can touch everything,你可以点击,你可以下载, 你可以触摸一切,
322and you don't really need to go into the terminal.而你真的不需要进入终端。
323Now below that, we have Olama.下面,我们有奥拉玛。
324This is a really popular option, especially for developers,这是一个非常流行的选择, 特别是对开发者来说,
325and it's just one command inside of your terminal它只是一个命令 在你的终端内部
326where you can talk with models, spin up a local server.您可以与模型交谈, 旋转本地服务器。
327You get the idea.你得到这个想法。
328然后我们有了Docker Model Runner。
329Now this is really good现在,这是真的好
330because it treats models like containers,因为它对待模型 像容器,
331which is perfect if you're actually gonna be deploying如果你真的要部署,那就完美了
332these alongside live applications.它们与现场应用同时存在。
333And at the bottom of my list here, we have full code.在我的名单底部, 我们有完整的代码。
334This is where you're running a model in pure Python,这里是你运行一个模型 在纯Python,
335and you see every single piece.你可以看到每一块。
336Now, no matter which way you wanna run these models here,现在,不管你想用哪种方式运行这些模型,
337you're gonna be making three decisions.你会做出三个决定
338You're gonna pick a model,你要选一个模特儿
339you're gonna pick a size and quantization你会选择一个大小和量化
340that fits inside of your memory,这符合你的记忆,
341and you're gonna decide how you wanna talk to it.你要决定怎么跟它说话
342So whether that's a chat window or something like code.所以,无论这是一个聊天窗口 还是类似代码的东西。
343If you keep that in mind,如果你记住这一点,
344every single one of these tools is gonna make sense.这些工具中的每一个都会有意义
345So let's start at the top.故从上起.
346And again, I'm gonna go through all of them再说一遍,我要翻遍他们所有
347and show you exactly how to run local models.告诉你如何运行本地的模型。
348Let's dive in.让我们潜入。
349So the first tool on my list here is LM Studio.我的第一个工具是LM工作室。
350I'll give you a quick walkthrough,我给你一个快速的走过,
351but this is one of the best ways to run local models.但这是管理本地模型的最佳方法之一
352Now, once you download the tool again, it's completely free.现在,一旦你再次下载工具,它完全免费.
353You're gonna be brought into a view你会被带入风景
354that looks something like this.看起来像这样
355From here, you're gonna go into the model view.从这里开始,你会进入模型视图。
356It looks like kind of a robot icon on the left-hand side.它看起来像一个机器人图标 在左手边。
357And you'll be able to search你会可以搜索
358through all of the available models通过所有可用的模式
359that you can download directly here.您可以在此直接下载。
360Now, what you'll wanna do is search for a model现在,你想做的是寻找一个模型
361that matches the kind of relative size匹配相对大小的类型
362or amount of memory that you have.或你的记忆量
363Again, if we're talking about larger high-end machines,再说一遍 如果我们说的是更大的高端机器
364you can typically get away with 27 billion, 35,你通常能逃出270亿 35亿
36530 billion parameters, et cetera.三百亿参数等.
366If you have eight gigs of RAM or 16 gigs of RAM,如果你有8个工作 或16个工作 RAM,
367look for ones that are eight billion parameters寻找80亿的参数
368or four billion parameters, much smaller sizes.或40亿参数,大小小得多。
369So for example, we have Gwen 3.8.例如,我们有格温3.8。
370You'll notice that if I click on this,你会注意到,如果我点击这个,
371I can view different levels of quantization我可以看到不同层次的量化
372and see the change in size right here.看这里大小的变化
373You also see kind of some icons or indications您还看到一些图标或指示
374of which model is the best for you based on your hardware.根据你的硬件,哪个型号最适合你。
375So you can see when it says full GPU offload possible所以你可以看到,当它说全GPU卸载的可能性
376and a little thumbs up,并竖起一小拇指,
377that's the one that you would wanna go with.那是你想去的那个
378And notice this number of Q4,注意这个Q4的号码
379that's the level of precision or the quantization level.这是精确度或量化度。
380So the lower, so like Q4, Q2, Q1,所以越低,就像Q4,Q2,Q1,
381the more quantization you have, right?越多的量化,对不对?
382So if you have Q8, you can see this is bigger所以,如果你有Q8,你可以看到 这是更大的
383than Q6 or Q4, and it's a pretty drastic difference.比Q6或Q4, 这是一个相当巨大的差异。
384You're also gonna wanna look at the capabilities,你也想看看他们的能力
385so vision, tool use, reasoning.因此,视觉,工具的使用,推理。
386If you need it to be able to analyze images,如果你需要它来分析图像
387you need vision.你需要见识
388If you want it to work in an agentic harness如果你想让它在 代理化的绳子上工作
389or an agent mode, you need tool calling.或代理模式,您需要工具呼叫。
390Hopefully you get the idea.希望你知道这个主意
391There's so many models,这么多模特儿
392I can't possibly go through all of them,我不可能通过他们所有的,
393but you get the idea you can browse through here但你有这个想法 你可以浏览这里
394and look at the ones that are going to match看看那些会匹配的
395your specific hardware and the sizes that make sense.您的特定硬件和大小 合理。
396Now, once you download the model,现在,一旦你下载模型,
397you can view your models from the model tab right here.您可以在这里查看模型标签。
398Now, in order to use these models,现在,为了使用这些模型,
399you do need to load them.你确实需要加载它们。
400So if I select a model like Gemma 4,所以如果我选一个像Gemma4的模特儿
401and I just bring open this sidebar here,我只是把这个侧柱打开,
402it will give me some options for actually loading它会给我一些选项 实际加载
403and running my model.和运行我的模型。
404So what I may wanna do here is go to the load tab所以,我想在这里做的是 去负载标签
405and start changing some of the values.并开始改变一些值。
406If you're a beginner, don't change anything如果你是初学者,不要改变任何东西
407and just run this directly.然后直接运行这个。
408The one thing you can't have a look at只有一件事你无法看
409is the context size here.这里为上下文大小。
410And keep in mind, the larger you make this context size,记住,你做的这个背景尺寸越大,
411the more room is gonna be taken up in your computer's memory在你的电脑记忆中,会占用更多的房间
412because all of this context needs to actually fit因为所有这些背景都需要实际适应
413in the GPU memory, right?在GPU的记忆,对不对?
414Or the memory that you have for running local models.或者你运行本地模型的记忆。
415There's a bunch of other settings you can use,还有一堆其他的设置你可以使用,
416but in this case, what we're gonna do但在这种情况下,我们该怎么办
417is just load the model.只是装上模型。
418Now, when we load the model,现在,当我们加载模型,
419same thing it asks us for the settings.同样的东西 它要求我们设置。
420We're gonna go ahead and load that.我们要继续装货
421It will take a second,需要一点时间
422and then we will be able to view that here然后我们可以在这里看到
423from this terminal view and also chat with it从此终端视图并与之聊天
424directly from the chat window.直接从聊天窗口。
425You can load multiple models at once,你可以马上装上多个模型,
426and you'll be able to see the models你会看到模特儿
427that are loaded up here as well as the size这里装满的,还有大小
428and then to check them.然后检查他们。
429So you can see that I'm currently using 5.58 gigabytes所以,你可以看到,我目前使用5.58千兆字节
430of the 63 gigabytes of RAM that I have.我拥有63千兆字节的RAM
431However, we're talking about GPU memory here,但是,我们说的是GPU的记忆,
432so that's not really 100% accurate.所以这不是真的100%准确。
433So if we go here to the terminal,如果我们到终点站
434we can now see that this model is loaded.我们现在可以看到这个模型已经装满了。
435I can view all of the API stuff for this我可以看所有API的东西
436in case I'm a developer and I wanna directly chat with it以防我是开发商 我想直接和它聊天
437using something like a curl command.使用类似卷曲命令。
438If that doesn't make sense to you, don't worry.如果你觉得不合理 别担心
439If you just wanna chat with the model,如果你想和模特儿谈谈
440you can go over to the chat view.你可以去聊天视图。
441So from here, we'll press new chat.因此,从这里,我们将按新的聊天。
442We're just gonna select the model that's already loaded.我们只是要选择 已经上膛的模型。
443因此谷歌Gemma 4.
444We can modify things here, for example,我们可以在这里修改,比如,
445like the system prompt if we wanna do that.如果我们想这么做 系统就会启动
446And then we can just start chatting directly with the model然后我们就可以直接和模型聊天了
447just like we would inside of something like chat GPT.就像我们在里面 喜欢聊天GPT。
448Now you can see this one is extremely fast, right?现在你可以看到这个非常快,对不对?
449We're getting 120 tokens per second我们每秒得到120个金币
450because it's very small.因为它很小。
451And again, I have high memory bandwidth再说一遍,我的记忆带宽很高
452because I'm using a dedicated GPU.因为我在使用专用的GPU.
453You can load multiple models您可以装入多个模型
454as long as they all fit into the memory here.只要他们都融入这里的记忆
455And then again, you can adjust all of the parameters.然后,你可以调整所有参数。
456And if you want to, you can start using them如果你想,你可以开始使用它们
457from this server, which is useful, especially for coding.来自此服务器, 特别是用于编码 。
458And you can see the full logs of everything that's gone on,你可以看到所有事情的完整记录
459tokens per second speed.每秒速度的符号。
460You get the idea.你得到这个想法。
461LM Studio is very good.LM工作室非常不错.
462There's a lot you can do with it.诸法无量.
463And if you want a full tutorial,如果你想要一个完整的教程,
464leave a comment down below and I will go into it.下面留点意见,我再谈
465So the next tool on my list here is Olama.我名单上的下一个工具是奥拉玛。
466Now this is a little bit more popular for developers这对开发者来说更受欢迎
467它和LM Studio有很相似之处
468However, it's a little bit less visual然而,它有点少视觉
469and gives you a bit less control.让你少点控制力
470Now Olama is a very popular way for downloading现在奥拉玛是一个非常流行的下载方式
471and running local models.并运行本地模型。
472In order to use it, you do need to download the tool.为了使用,您确实需要下载工具.
473所以你可以直接去olama.com
474and it will be available inside of your terminal在你的终端里可以找到它
475as a command.作为命令。
476So if you type Olama in your terminal once it's downloaded,所以,如果你打 奥拉玛在你的终端 一旦下载,
477sorry, you should see something like this对不起,你应该看看这样的东西
478where you can launch it for all kinds of tools在那里你可以推出它 各种工具
479or you can directly chat with different models.或者你可以直接和不同的模型聊天。
480Now, as well as the terminal or CLI based tool,以及终端或基于CLI的工具
481there is also a visual tool that you can open还有一个可以打开的视觉工具
482when you download the desktop application.当您下载桌面应用程序时。
483From here again, you can launch Olama再来一次,你可以发射奥拉玛
484inside of any of these harnesses在任何这些绳子里面
485and use models that you've downloaded.并使用你下载过的模型。
486You can go into the settings, right?你可以进入环境,对不对?
487Or you can actually just start chatting或者你可以开始聊天
488with different models by selecting one通过选择一个来使用不同的模型
489of the ones that you have.你拥有的。
490Now, in order to download models in Olama,现在 为了在奥拉玛下载模型
491what you're gonna do is start by finding the model你要做的是从找到模型开始
492that you want.说你想说的
493So you're gonna have to go to the Olama hub.所以你得去奥拉玛中心
494So by doing that, you can go Olama and then models.因此,通过这样做,你可以去奥拉玛然后模型。
495From here, there's a bunch of models从这里,有一群模特
496that are available for Olama.给奥拉玛的
497Same thing, you can search through them.同样的事情,你可以搜索 通过他们。
498You can ask ChatGBT to help you find one.你可以请ChatGBT帮助你找到一个.
499And if you find a model that you want,如果你找到一个你想要的模型,
500so actually let's go maybe Nemotron 3.5 Lightning here,因此,实际上让我们去 也许尼莫特隆3.5闪电在这里,
501we can see all the different sizes.我们可以看到所有不同的尺寸。
502We now understand what B stands for我们现在明白B代表什么
503and what quantization is, right?而什么是量化,对不对?
504So we can have a look at them here好让我们看看这里
505and we can pull them directly inside of Olama.我们可以直接把他们拉进奥拉玛
506So the way this works is the following.因此,这个方法是:
507First, you can type Olama list.首先,你可以输入奥拉玛列表.
508If you type list, this will show you all the models如果您输入列表, 这将显示所有模型
509you currently have downloaded.您已下载 。
510And then if you wanna pull a model, you'll type Olama pull然后,如果你想拉一个模型, 你会打奥拉玛拉
511and then the model ID that you found from the model hub.然后从模型中心找到的模型ID。
512This is gonna download it to your computer这个会下载到你的电脑上
513and then allow you to start using it.然后让你开始使用它。
514If you wanna run a model, you can type Olama run如果你想运行一个模型,你可以打 奥拉玛运行
515and then put the model ID.然后把模式ID。
516So I'm gonna put Nemotron 3 like this所以我要把尼莫特龙3这样
517and it will start the model.它会启动模型。
518It will load it into my computer's memory.它会把它装进我电脑的记忆里
519This is why we'll always take a second at the beginning这就是为什么我们总是在开始的时候花一秒钟
520cause it actually needs to load it.因为它实际上需要加载它。
521Then you can start chatting with it directly from this view.然后你可以直接从这个视图开始与它聊天.
522So here you can see, I can type something like hello world所以这里你可以看到,我可以打一些东西 像你好世界
523and I can just directly start using this local model.我可以直接开始使用这个本地模型。
524Now, as well as that, I can do that from this terminal view.现在,还有,我可以从这个终端的角度来做。
525So if I go to, let's go Nemotron Nano or something,所以,如果我去, 让我们去尼莫特隆纳诺什么的,
526I can type hello.我可以打个招呼。
527Same thing, we need to wait for it to be loaded同样的事情,我们需要等待它被装上
528and then it will give us a response.然后它将给我们一个回应。
529Sometimes it takes a second, especially on the first load有时要花点时间 尤其是第一次
530but you can see we get the thinking但你可以看到 我们得到的想法
531and then we get the response.然后我们得到回应。
532And if we go back here, hello, how can I assist you today?如果我们回到这里,你好,我有什么可以帮助你今天?
533Now this is great, but Olama will also expose现在这是伟大的,但奥拉玛也会暴露
534all of its services on an API.所有服务在API。
535So for example, if I type Olama help,比如,如果我输入奥拉玛的帮助,
536you're gonna see an option你会看到一个选择
537of all of the different things that you can do.所有不同的事情 你可以做的。
538As long as Olama is running,只要奥拉玛在跑
539it will actually serve all of its models它实际上将服务于它的所有模式
540available on a default port.在默认端口上可用。
541I don't remember exactly what the port is我不记得港口到底是什么
542but I believe it's something like 11,434但我相信是11,434号
543which means that you're actually able to send也就是说你实际上可以发送
544curl requests and use Olama from other tools卷曲请求并使用其他工具的 Olama
545as long as it's running in the background.只要它运行在背景。
546I'm not gonna go into a full tutorial of it我不会去一个完整的辅导它
547but if you're a developer and you understand但如果你是一个开发者 你明白
548what a REST API is, Olama provides that already欧拉玛已经提供了
549with access to all of the models能够访问所有模型
550and will automatically load any model that you ask it for并自动加载您想要的任何模型
551whenever you try to send a request to it.当你试图向它发出一个请求。
552It actually has what's called an open AI compatible API它实际上有一个所谓的开放的 AI兼容API
553which means that you will be able to send requests这意味着您将可以发送请求
554in the same format that you would to something和你想的一样
555像ChatGBT或Anthropic一样。
556Anyways, that is Olama, let's go to the next example.总之,这是奥拉玛, 让我们来看看下一个例子。
557So the next tool on my list here is the Docker model runner.我名单上的下一个工具是Docker模型跑者。
558Now this is available as an experimental feature现在这个是实验性的
559在 Docker 桌面内。
560There is a bunch of restrictions with it.有很多限制。
561However, if you are gonna be doing this但是,如果你要这样做
562在 Linux 机器上
563and you have Nvidia hardware, it works very well.你有Nvidia的硬件, 它的工作非常好。
564It can work on CPU as well I believeCPU也能用,我相信
565however it's extremely slow.但它非常缓慢。
566So with Docker model runner, if you go into Docker desktop因此,与Docker模型跑车, 如果你进入Docker桌面
567there is some settings I believe you need to enable有一些设置 我想你需要启用
568this experimental feature, you should see this models tab.此实验功能, 您应该看到此模型标签 。
569From the models tab, you'll be able to go to Docker hub从模型标签,你可以去Docker枢纽
570and then here you can pull all of the same type of models然后在这里,你可以拉 所有相同的型号
571as you would be able to inside of like Olama or LM studio.就像奥拉玛或LM工作室
572Once you have a model here, you can chat with it directly.一旦你有一个模型在这里,你可以直接与它聊天.
573So I have Gemma three, for example, same thing所以我有Gemma 3,比如说,同样的事情
574it will automatically load the model for me它会自动为我装上模型
575and then I can type something like hello.然后我可以打出像你好的东西。
576Now, similarly to all of the other tools现在,和所有其他工具一样
577this will also expose a rest API on a different port.这也将暴露一个休息的API在另一个端口。
578I believe it's 12,434 or 343 that will allow you我相信是12,434或343允许你
579the ability to chat with these models与这些模型交谈的能力
580without being directly inside of this interface.而不直接在此界面内。
581You can also inspect the model,你也可以检查模型,
582see all the information about it, et cetera.见一切诸法等.
583What's interesting about the Docker model runner多克模特跑车有什么好玩的
584is that it actually treats models like containers.实际上它把模型当成容器
585What that means is that you can write Docker files,这意味着你可以写Docker文件,
586you can write compose files您可以写作文件
587and you can actually have models shipped directly也可以直接运出模型
588with your applications and be dependencies exposed与您的应用程序并暴露依赖关系
589through Docker kind of services,通过多克的服务,
590which is a lot more complicated这要复杂得多
591than I'm going to get into in this video.而不是我要进入这视频。
592But if you do use Docker and you're familiar with this但是如果你真的用Docker 你熟悉这个
593and you use it for your apps and you want local models,你用它来做你的应用 你需要本地的模型,
594this is a really good way to deploy them.这是部署他们的好办法
595Now I'll also show you that there is a CLI based tool.现在,我也会告诉你,有一个基于CLI的工具。
596So similarly to what we had before,跟我们以前一样
597if I type something like Docker model,如果我输入的东西 像Docker模型,
598you can see that we can configure,你可以看到,我们可以配置,
599inspect, install the runner, push RM,检查,安装跑者,推RM,
600view the models, load, unload.查看模型,装货,卸货。
601You guys get the idea你们知道这个主意
602and you can view models directly inside of here as well.也可以直接在这里查看模型
603So this is a really powerful feature.这是一个非常强大的特征。
604And if you want a full tutorial on it,如果你想要一个完整的辅导,
605I have actually done that on my channel.我确实在我的频道上做了
606You can see the easiest way to run LMS locally,你可以看到在本地运行LMS最简单的方式,
607Docker模特跑车辅导,
608goes through all of the features通过所有的特性
609and we'll even show you all of the Docker files我们甚至会给你们看所有的Docker文件
610and how to set it up with the automatic deployment.和如何设置它与自动部署。
611Okay, that is model runner.好吧,这是模型跑者。
612Now let's move to the last one, which is full code.现在,让我们移动到最后一个, 这是完整的代码。
613Okay, so the last example I have for you好,我给你的最后一个例子
614is actually running models using just code.正在使用简单的代码运行模型。
615So this means that we're actually gonna bring所以这意味着我们真的会带来
616in our own inference engine, in this case, llama CPP,我们自己的推论引擎, 在这种情况下,拉玛CPP,
617and not rely on something like olama而不是依赖像奥拉玛一样的东西
618or Docker model runner or LM studio to do this for us.或Docker模特跑车 或LM工作室 这样做为我们。
619Now the big surprise is that llama CPP is the engine现在最大的惊喜是拉玛CPP是引擎
620that pretty much all of the tools that we just looked at几乎所有的工具 我们刚刚看
621are already using,已经在使用,
622but if we want to invoke it directly ourself,但如果我们想直接援引它,
623we can do that.我们可以做到这一点。
624So for example, you'll see we have this Gwen 2.5 model,比如说,你会看到我们有Gwen 2.5模型
625which I've downloaded locally on my computer.我从电脑上下载的
626Again, this is literally just a file再说一遍,这只是一个文件
627that contains a bunch of numbers.里面有一堆数字
628Now, if I want to run this,现在,如果我想运行这个,
629normally I would need olama or something like that,通常我需要欧拉玛之类的东西
630but I can actually write code但我可以写代码
631that will invoke it directly for me.它会直接为我引用它。
632So you'll see that I can just load the model.所以你会看到,我可以只是装上模型。
633I can then create a response using this package.然后,我可以用这个软件包创建一个响应。
634And if I just run the code here,如果我在这里运行密码
635you will see that I get the following.你会看到,我得到以下。
636In my heart, I run AI on my desk running free在我的心里,我运行AI在我的桌子上 免费运行
637and it wrote me write a haiku or whatever you call this它写我写一个海库 或任何你所谓的这个
638about running AI on your own computer.关于运行AI 在自己的计算机。
639Now I can change this prompt to be,现在我可以改变这个速度,
640hey, who is Tim or something?嘿,谁是蒂姆什么的?
641I don't know if that's gonna give us anything meaningful,我不知道这会不会给我们带来什么意义
642but let's run this.但让我们运行这个。
643And Tim is a character from a popular video game,蒂姆是一个流行电子游戏的人物
644whatever, right?随便吧?
645So this is a very small model.这是一个很小的模型。
646Of course, it's not gonna give us good responses,当然,它不会给我们好的答复,
647but you get the idea.但你明白这个想法
648We can run it fully locally.我们可以完全在当地运行。
649Now, one thing to keep in mind is that as well as doing this,现在,有一件事要记住 除了这样做,
650we can actually chat with models我们可以和模特儿聊天
651that are running on our own computer正在我们自己的电脑上运行
652透过olama等服务.
653So like I was mentioning,就像我刚才提到的那样
654if olama is installed and running,如果olama安装和运行,
655you can specify the model that's actually available您可以指定实际可用的模型
656在你下载的olama。
657And then similarly to before,跟以前一样
658I can run something like this.我可以运行这样的东西。
659In this case, it's gonna be a bit slower这样的话,会慢一点
660cause llama two is much larger.因为拉玛2更大
661And you'll see that we actually get the response, right?你会看到,我们实际上得到了回应,对不对?
662And it says, hey, someone might choose它说,嘿,有人可能会选择
663to run an AI model locally, blah, blah, blah, blah.在当地运行一个AI模型,等等,等等,等等。
664And it's using that olama backend service.它正在使用 olama后端服务。
665And if I wanted to, I could even change this如果我想,我甚至可以改变这个
666到LLM API,对不对?
667或 LM 工作室 API 或 Docker 模型跑者 API
668and do the exact same thing right from code.并做同样的事情 从代码。
669So this is kind of the more manual method,所以,这是一种 更手工的方法,
670but most developers are gonna end up managing their models但大多数开发者最终会管理他们的模型
671through something like olama.穿过像olama的东西。
672And then invoking them in code using a method like this.然后用这种方法在代码中引用它们。
673Okay, so that wraps up the demos.好吧,这样就结束了演示。
674Now let's talk about which method you should actually use.现在我们来谈谈你应该使用哪种方法。
675So here's my honest take.所以,这是我诚实的拍摄。
676If you just want to chat with the model如果你只想跟模特儿聊天
677and you never want to see a terminal,你永远不想看到一个终端,
678then you can use something like LM studio.那样你就可以用LM工作室
679It's genuinely one of the easiest ways to download models这是最容易下载模型的方法之一
680and has some of the most amount of features.并且拥有一些数量最多的特征.
681If you're a developer and you want a model running如果你是开发商,想要一个模型运行
682on your own machine that your scripts and apps can talk to,在你自己的机器上 你的脚本和应用程序可以说话,
683绝对使用olama。
684That's what I reach for most days大部分时间我都是这样
685and it works really well locally.并且它在当地非常有效。
686If you're already living inside of a Docker container如果你已经住在多克容器里
687and you want models sitting in that stack right next to you,你想让模特坐在你旁边
688then use Docker model runner, right?然后用Docker模型跑车 对吧?
689It's really good in production.生产上真的很好
690If you're actually building and deploying things out.如果你真的在建造和部署东西
691And lastly, if you want to understand everything最后,如果你想知道一切的话
692that you're doing and run models yourself你做和运行 模特自己
693in probably the most efficient way,也许是最有效的方式,
694then you can use your own code to do so.那样你就可以用你自己的代码了
695Of course, you don't need to use Python.当然,你不需要使用Python。
696This is just a quick example.这只是一个简单的例子。
697And with that in mind, just remember that all of these tools记住这些工具
698at the end of the day are using the same building blocks最终是用同样的构件
699that we talked about earlier.我们之前说过的
700They have a model, which again,他们有一个模型,再次,
701is literally just a bunch of numbers in a file字面上只是文件里的一堆数字
702and they have an inference engine他们有一个推论引擎,
703and a bunch of other fancy features on top of it.上面还有一堆其他的花样
704If you understand that, you understand local models如果你明白这一点,你就明白本地的模型
705and hopefully this video helped get you off the ground希望这段视频能帮助你脱身
706and running your first one on your own device.然后用自己的设备运行第一个
707Anyways, guys, that's all that I have for you.总之,伙计们,我只有这些了
708If you enjoyed, make sure you like, subscribe如果你喜欢,确保你喜欢,订阅
709and I will see you in the next one.我会看到你在下一个。
710It's Friday.礼拜五
该视频共有字幕 710 条。解锁更多字幕为会员功能,请移动到 价格