The other big topic is Google Colab, and that is the other thing that we're going to be using today 另一个重要主题是 Google Colab，这也是我们今天要使用的另一个东西
as we we it's all about new stuff today. 对于我们来说，今天的一切都是关于新事物的。
So Google Colab, you may have already used it. 那么Google Colab，你可能已经用过它了。
A lot of people have used it already and they're like, why don't we start with Google Colab? 很多人已经使用过它，他们会想，为什么我们不从 Google Colab 开始呢？
There's a lot of a lot to love about Google Colab. Google Colab 有很多值得喜爱的地方。
First of all, what is it? 首先，它是什么？
So it is something which allows you to to run a notebook. 所以它可以让你运行笔记本。
Notebook is this kind of interface we've been playing with in cursor when you have like, like cells 当你有类似的单元格时，笔记本就是我们在光标中使用的这种界面
of code that you run a cell at a time, there's very experimental way of interacting with code. 一次运行一个单元的代码，有一种非常实验性的与代码交互的方式。
So Google has built something that lets you run a notebook like that, except you're running it in a 因此，谷歌已经构建了一些东西，可以让你运行这样的笔记本，只不过你是在一个
browser, you're running it in a browser window, and it's actually running on one of Google's computers. 浏览器，您在浏览器窗口中运行它，它实际上在 Google 的一台计算机上运行。
So you can like bring up a like a Chrome page, point it at a Google URL, and then you effectively 因此，您可以打开类似 Chrome 的页面，将其指向 Google URL，然后您就可以有效地
have like like a boxes there, and you're remoting in to a Google box and you're able to run the code. 那里有一个盒子，您可以远程连接到 Google 盒子，并且可以运行代码。
And when you run the cell, it's as if it's running in your browser, but of course it's not. 当您运行该单元时，就好像它在浏览器中运行一样，但当然不是。
The code is executing on one of Google's machines out there in the cloud, and you're seeing the results 该代码正在云端的 Google 机器上执行，您将看到结果
immediately. 立即地。
So it lets you remote in to a to a remote box running on Google's cloud. 因此，它可以让您远程访问在 Google 云上运行的远程设备。
And there are a few things about this that are really great. 这其中有一些非常棒的事情。
One of them is that it allows you to collaborate in this super seamless way with other people on the 其中之一是，它允许您以这种超级无缝的方式与网络上的其他人进行协作
same code. 相同的代码。
Like in the same notebook construct. 就像在同一个笔记本结构中一样。
Google is famous, of course, for Google Docs for really bringing the kind of collaborative office 当然，Google 因 Google Docs 真正带来了协作办公而闻名
idea, uh, to, to the mainstream. 想法，呃，到，到主流。
And so everyone's very familiar with this idea that you can share a Google doc and share a sheet and 所以每个人都非常熟悉这个想法，你可以共享 Google 文档并共享表格，
be able to to work together with someone else in it and really collaborate. 能够与其他人一起工作并真正协作。
And Google Colab is bringing that same mentality to a notebook so that you can be coding with somebody Google Colab 正在将同样的心态带入笔记本中，以便您可以与某人一起编码
else. 别的。
It's not quite you don't quite get to see the changes in quite the same way, but it's almost as good 并不是说你不能以完全相同的方式看到这些变化，但它几乎一样好
as that. 那样。
And you can both be adding code and running things. 您既可以添加代码又可以运行东西。
And so it's such a great way to work together with people and, you know, it's like a it's a different 所以这是一种与人合作的好方法，你知道，这就像一种不同的方式
mindset to something like a using a repo where you where you check stuff in and merge it and so on. 心态类似于使用存储库，您可以在其中签入内容并合并它等等。
It's much more like live working, but it suits the notebook mindset, that experimental mindset, it 它更像是现场工作，但它适合笔记本思维、实验思维，它
works so well with that. 效果很好。
So very collaborative as as the name suggests. 正如其名称所暗示的那样，非常具有协作性。
Uh, and it's also integrated with, with the other Google services. 呃，它还与其他谷歌服务集成。
So, so later this this week we're going to to pull Google Drive in so you can have your Google Drive 因此，本周晚些时候我们将引入 Google 云端硬盘，以便您可以拥有自己的 Google 云端硬盘
docs available there too, which is very convenient. 那里也有文档，非常方便。
So for many reasons it is convenient. 因此，出于多种原因，它很方便。
But above all else the real the. 但最重要的是真实的。
So what is that? 那么那是什么？
It gives you access to high end GPUs. 它使您可以访问高端 GPU。
That's that's the big deal. 这才是最重要的。
And I probably need to mention, just in case you don't, uh, you haven't got the connection between 我可能需要提一下，以防万一你不这样做，呃，你没有得到两者之间的联系
what we're doing and GPUs. 我们正在做什么和 GPU。
I mean, obviously everyone knows about Nvidia stock and that GPUs are at the heart of, of modern AI. 我的意思是，显然每个人都知道 Nvidia 股票，并且 GPU 是现代人工智能的核心。
But but if you're wondering why, when we talk about these models with these huge number of parameters, 但是，如果你想知道为什么，当我们谈论这些具有大量参数的模型时，
these tons and tons, these 8 billion numbers, when you when you're predicting the most likely next 当你预测下一个最有可能的情况时，这吨又吨，这 80 亿个数字
token, the way you do that is by taking all of these numbers and multiplying them repeatedly by the 令牌，你这样做的方法是获取所有这些数字并将它们反复乘以
sort of input sets of tokens in some very clever way, which is known as the transformer architecture, 以某种非常聪明的方式对输入的标记集进行排序，这被称为变压器架构，
which is the way that these things will hook together and you're doing lots of multiplications and adding 这就是这些东西连接在一起的方式，你要做很多乘法和加法
multiplications and adding is basically matrix math, linear algebra. 乘法和加法基本上是矩阵数学，线性代数。
It's lots and lots of matrix calculations, and they can all happen very efficiently in parallel with 这是大量的矩阵计算，并且它们都可以非常有效地并行发生
one another. 彼此。
They're all sort of independent. 他们都是独立的。
So they can all run together in this very, very efficient way. 所以他们可以以这种非常非常有效的方式一起运行。
But they all have to run. 但他们都必须跑。
And it turns out when, when all this is becoming a big thing, in the early 2000, people were saying 事实证明，当这一切变得一件大事时，在 2000 年初，人们说
what we really need is like specialized custom hardware that is that is efficient, that is designed 我们真正需要的是专门的定制硬件，它是高效的，是经过设计的
for matrix calculations in in fast, real time. 用于快速、实时的矩阵计算。
And you can imagine all of these scientists sitting around there thinking about this. 你可以想象所有这些科学家坐在那儿思考这个问题。
And while they were doing it, the other people in the room were busy playing Doom or Quake or whatever 当他们这样做时，房间里的其他人正忙着玩《毁灭战士》或《雷神之锤》或其他游戏
was big in those days and, uh, using using PCs with which were like hammering away at drawing this 那时候很流行，呃，使用电脑就像是在不停地画这个
3D graphics. 3D 图形。
And the way that you do these kinds of games is by doing a lot of quick polygon calculations, which 玩这类游戏的方法是进行大量的快速多边形计算，这
involves lots of efficient matrix maths. 涉及大量有效的矩阵数学。
So the graphics cards, everyone was trying to buy a PC with a bigger graphics card. 因此，显卡方面，每个人都试图购买具有更大显卡的电脑。
Those graphics cards were basically custom hardware designed to run matrix calculations, multiplies 这些显卡基本上是定制硬件，设计用于运行矩阵计算、乘法
and adds in parallel like huge numbers of them at the same time so that it could draw, uh, screens 并同时添加大量的数据，这样它就可以绘制，呃，屏幕
like 60 times a second or whatever. 比如每秒 60 次或其他什么。
Uh, and so it turned out that this kind of hardware was absolutely perfect for the kinds of AI that 呃，事实证明，这种硬件对于人工智能来说绝对是完美的。
we were doing at the time and that we are still doing to this day. 我们当时就在这样做，而且直到今天我们仍然在这样做。
Uh, and luckily for Nvidia. 呃，Nvidia 很幸运。
And so that is why GPUs you probably do all that already. 这就是为什么 GPU 可能已经完成了这一切。
So I'm sorry. 所以我很抱歉。
That's why GPUs are so essential to to modern day AI. 这就是为什么 GPU 对于现代人工智能如此重要。
And they're quite expensive. 而且它们相当昂贵。
And what you really need more than anything is you need them to have a lot of memory, which typically 你真正需要的最重要的是你需要它们有大量的内存，这通常
you need, like it's different to the memory of your computer. 您需要的，就像它与您计算机的内存不同一样。
The GPU also has Ram, as games players all know, and you need to have enough to fit all of the model GPU 也有 RAM，游戏玩家都知道，你需要有足够的内存来适应所有模型
on. 在。
And if you're training, you need a lot more than that too. 如果你正在训练，你需要的还远不止这些。
And so you need a lot of memory on your GPU for it to be able to run efficiently. 因此，GPU 上需要大量内存才能高效运行。
And that's a problem. 这是一个问题。
And as, uh, that's not a problem, that's expensive and is the constraint. 因为，呃，这不是问题，这很昂贵，而且是限制。
And Apple people will know. 苹果公司的人都会知道。
Well, like I might happen to be a mac person, uh, that, uh, one of the great things about Apple 好吧，就像我碰巧是一个 mac 用户一样，呃，呃，Apple 的伟大之处之一
Silicon is that you have what's called a unified memory, which means that the memory that your CPU Silicon就是你有所谓的统一内存，这意味着你的CPU的内存
uses is the same as the memory the GPU uses. 使用的内存与 GPU 使用的内存相同。
So you can you can share it together, which is really amazing. 所以你们可以一起分享，这真是太棒了。
But for PCs, you typically have to get a graphics card with big enough memory. 但对于 PC，您通常必须拥有足够大内存的显卡。
And they're expensive. 而且它们很贵。
They are many thousands of dollars and boxes which have big Nvidia chips on on them. 它们价值数千美元，盒子上装有大型 Nvidia 芯片。
Graphics cards are very expensive. 显卡非常昂贵。
You can buy good ones for like $6,000 or something. 你可以花 6,000 美元左右买到好的。
They're expensive, but there's an alternative. 它们很贵，但还有其他选择。
There is an alternative and it's called Google Colab, where you rent GPUs in the cloud instead. 还有一种替代方案，称为 Google Colab，您可以在云中租用 GPU。
And so here are the details you get when you connect to Colab. 以下是连接到 Colab 时获得的详细信息。
You choose a runtime and runtime is it's name of like the, the, uh, like the instance that you're 您选择一个运行时，运行时的名称就像您所在的实例一样
connecting to on the cloud. 连接到云端。
And it includes like a kernel, like we're used to a Python process that's, that's running there. 它包括一个内核，就像我们习惯的Python进程一样，它在那里运行。
And you can get some that are CPU based, meaning that there's no graphics card at all, there's no 你可以得到一些基于CPU的，这意味着根本没有显卡，没有
GPU, so you can just use it for everyday tasks, a bit like you can on your own computer. GPU，因此您可以将其用于日常任务，就像在自己的计算机上一样。
You can have ones with a lower spec GPU. 您可以使用较低规格的 GPU。
It's still pretty mighty. 威力还是蛮大的
It's still a powerful GPU. 它仍然是一个强大的 GPU。
The typical one is the Nvidia Tesla T4. 典型的是 Nvidia Tesla T4。
The T4 is the typical one. T4是典型的一款。
It has 15GB of GPU Ram, which is a lot. 它有 15GB 的 GPU RAM，这已经很多了。
And here's the thing. 事情是这样的。
It's free. 它是免费的。
It's it's completely free. 它是完全免费的。
You can have a Google Colab with a T4 GPU, and you can have it for free at any point. 您可以拥有配备 T4 GPU 的 Google Colab，并且可以随时免费获得。
And we're just gonna do it in just a second. 我们只需一秒钟就能完成。
Can you believe it? 你能相信吗？
And that's what you'll be using for this week, for week three and for week seven on this course when 这就是您本周、第三周和第七周在本课程中将使用的内容
we are running on GPUs in the cloud. 我们在云端的 GPU 上运行。
So that's amazing. 所以这太棒了。
And then if you want to splash out you can pay to have a higher spec one, including an A100 for 40GB. 然后，如果你想花大钱，你可以花钱购买更高规格的产品，包括 40GB 的 A100。
But when I say splash out, we're talking about like a few bucks an hour. 但当我说“splash out”时，我们指的是每小时几美元。
We're talking about like, you know, a Big Mac an hour kind of level. 我们谈论的是，你知道，每小时一个巨无霸的水平。
I believe we'll do the maths later to see exactly how much it costs. 我相信我们稍后会计算一下具体要花多少钱。
But, uh, it's it's, uh, I was going to say it's cheap. 但是，呃，就是它，呃，我想说的是它很便宜。
And you might disagree with me there. 你可能不同意我的观点。
You might say a few dollars an hour is not cheap at all, but compare it with the cost of buying an 你可能会说每小时几美元一点也不便宜，但与购买一台电脑的成本相比
A100 on a PC that you're going to have for yourself. 您将拥有自己的 PC 上的 A100。
That that is an expensive proposition. 这是一个昂贵的提议。
And when you think of it in that light, to be able to run it for $2 an hour only when you need it, 当你从这个角度思考时，只有在你需要的时候才能以每小时 2 美元的价格运行它，
and then you don't use it anymore, you don't keep it running. 然后你不再使用它，不再让它运行。
You just you only pay for the minutes that you have it alive. 您只需为您还活着的分钟数付费即可。
That's it. 就是这样。
It seems like it's actually a really great deal. 看起来这确实是一笔很大的交易。
And I feel like we are lucky to have this ability to rent super high powered horsepower whenever we 我觉得我们很幸运，每当我们有能力租用超大马力
want it. 想要它。
And so, yeah, I think this is fabulous. 所以，是的，我认为这太棒了。
And that's why I always when people say to me, I want to buy a box with blah, blah, blah, blah, 这就是为什么我总是当人们对我说，我想买一个盒子，里面装着等等，等等，等等，
I say, really, really, because you know that that you can have as many a100s as you want for a fraction 我说，真的，真的，因为你知道你可以用一小部分的钱拥有任意数量的 a100
of that, uh, just, you know, every weekend. 其中，呃，只是，你知道，每个周末。
So anyways, the, the other the final sales pitch for it and then I'll shut up the, the other point 所以无论如何，另一个最终的销售宣传，然后我会闭嘴，另一个点
to make is that GPUs do go obsolete pretty quickly. 值得一提的是，GPU 确实很快就会过时。
The GPUs that are hot today might not be hot in a year's time. 今天很热门的 GPU 一年后可能就不那么热门了。
And if you buy one, you're kind of stuck with it, but with with Google Colab, you just get the whatever 如果你买了一个，你就会被它困住，但有了 Google Colab，你就可以得到任何东西
they have on offer. 他们有提供。
They have a range of different boxes that you can get. 他们有一系列不同的盒子可供您购买。
And so it's also a nice way to always stay current. 因此，这也是始终保持最新状态的好方法。
I guess it's like leasing a car, you know, it's like it's the buy versus versus lease kind of conundrum 我想这就像租赁一辆车，你知道，这就像购买与租赁之类的难题
that people think about. 人们所思考的。
Anyways. 无论如何。
That is Google Colab. 那就是谷歌Colab。
All right. 好的。
So I just took like ten minutes of your time just talking about this thing. 所以我只花了大约十分钟的时间来谈论这件事。
We need to go and see it. 我们需要去看看。
Let's go and see it. 我们去看看吧。
So look there's people constantly ask me how to find the link to the Google Colab that we use in these 所以看，有人不断问我如何找到我们在这些中使用的 Google Colab 的链接
courses. 课程。
And I've put the links everywhere, but but so one place they are is that if you go into the repo week 我已经把链接放在各处了，但是有一个地方是，如果你进入回购周
three, day one, there is a notebook there in in cursor with a link to the Colab. 第三天，第一天，光标处有一个笔记本，其中有 Colab 的链接。
But also if you look in the readme, there's a link to the Colab. 但如果您查看自述文件，也会发现 Colab 的链接。
If you look in the class resources, there's a link to the Colab. 如果您查看课程资源，就会发现 Colab 的链接。
Like I don't know, you have to just not look anywhere, look up at the ceiling and you won't see it, 我不知道，你必须不看任何地方，抬头看天花板，你就看不到它，
but it's everywhere else, so you got no excuses. 但它无处不在，所以你没有任何借口。
You can find the link to the colab and I will see you right there. 您可以找到 Colab 的链接，我会在那里见到您。