（欢快的音乐） (upbeat music)
- 在这个视频中，我会给你 - In this video, I'm going to give you
快速介绍我们的变压器模型 a very quick introduction to how our transformer models
与 Tensorflow 和 Keras 一起工作。 work together with Tensorflow and Keras.
非常简短的解释 The very short explanation
是我们所有的 Tensorflow 模型 is that all of our Tensorflow models
也是 Keras 模型对象， are also Keras model objects,
因此他们拥有标准的 Keras 模型 API。 and so they have the standard Keras model API.
如果你是一位经验丰富的机器学习工程师 If you're an experienced machine learning engineer
谁经常使用 Keras，这可能就是你需要知道的全部 who's used Keras a lot, that's probably all you need to know
开始与他们合作。 to start working with them.
但对其他人来说， But for everyone else,
包括那里的浪子 PyTorch 工程师 including the prodigal PyTorch engineers out there
正在回归的人， who are returning to the fold,
我将快速介绍 Keras 模型， I'm going to quickly introduce Keras models,
以及我们如何与他们合作。 and how we work with them.
在我将在下面链接的其他视频中， In other videos, which I'll link below,
我将更详细地介绍 Keras 模型的训练。 I'll run through training with Keras models in more detail.
但首先，从高层次上讲，什么是 Keras 模型？ But first, at a high level, what is a Keras model?
所以你的模型基本上包含了你的整个网络。 So your model basically contains your entire network.
它包含层，以及这些层的权重， It contains the layers, and the weights for those layers,
并告诉模型如何处理它们 and also tells the model what to do with them
所以它一路定义了整个路径 so it defines the whole path all the way
从你的输入到你的输出。 from your inputs to your outputs.
如果你以前使用过 Keras， If you've used Keras before,
你可能开始使用模型对象 you probably started using model objects
通过手工构建它们， by building them out by hand,
你一层又一层地添加 you added one layer after another
并且可能使用 model.add () 或功能方法。 and maybe using the model.add () or the functional approach.
这并没有错。 And there's nothing wrong with that.
许多伟大的模型都是以这种方式构建的 Lots of great models are built that way
但你也可以预加载整个模型、权重和所有内容。 but you can also pre-load an entire model, weights and all.
这真的很有帮助，因为如果你， And this is really helpful, because if you,
正如你在这里看到的，如果你尝试阅读这篇论文 as you can see here, if you try reading the paper
或者如果你尝试查看代码， or if you try looking at the code,
你会看到 Transformer 的内部非常复杂， you'll see the inside of a Transformer is pretty complex,
从头开始把它写出来并把它做好 and writing it all out from scratch and getting it right
即使对于有经验的人来说也很难 would be hard even for an experienced
机器学习工程师。 machine learning engineer.
但因为它都装在一个模型里， But because it's all packed inside a model,
你不需要担心那个的复杂性 you don't need to worry about that complexity on that
如果你不想。 if you don't want to.
如果你是一名研究人员，如果你想真正深入研究 If you're a researcher, if you want to really dig in there
你可以，但你也可以只加载一个预训练的， you can, but you can also just load a pre-trained,
只需一行代码即可预配置变压器模型。 pre-configured transformer model in just one line of code.
当我之前提到 Keras API 时， And when I mentioned earlier about the Keras API,
它的优点是 the advantage of it is that
你是否从头开始编写自己的模型 whether you write your own model from scratch
或者加载一个预训练的，你与模型交互 or load a pre-trained one, you interact with the model
通过相同的 API，所以你使用 through that same API, so you use exactly
同样的几种方法，你会看到它们 the same few methods and you're gonna see them
一次又一次，这些方法就像适合， again and again, these methods like fit,
编译和预测，就像我提到的 compile and predict, and like I've mentioned
我们将介绍如何使用这些方法的具体示例 we'll cover concrete examples of how to use those methods
在我将在下面链接的视频中。 in the videos I'll link below.
现在要从这个视频中拿走的关键是， For now the key thing to take away from this video,
如果你以前从未见过 Keras， if you've never seen Keras before,
是这种简洁的封装意味着 is that this neat encapsulation means
一个巨大的神经网络的所有复杂性 that all the complexity of a huge neural net
变得易于管理，因为你与它互动 becomes manageable, because you interact with it
以完全相同的方式，使用完全相同的方法， in exactly the same way, using exactly the same methods,
是否是一个庞大的预训练语言模型 whether it's a huge pre-trained language model
或你手写的简单模型。 or a simple model that you wrote out by hand.
（欢快的音乐） (upbeat music)