docs(chapter5): 添加LLaMA2结构图并更新依赖

更新requirements.txt中的pytorch为torch以保持一致性
This commit is contained in:
KMnO4-zx
2025-06-09 22:14:01 +08:00
parent d35c1d0bc8
commit 9efbb69dfd
3 changed files with 8 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
pytorch==2.4.0
torch==2.4.0
torchvision==0.19.0
datasets==2.16.1
jsonlines==4.0.0

View File

@@ -4,6 +4,13 @@
Meta原Facebook于2023年2月发布第一款基于Transformer结构的大型语言模型LLaMA并于同年7月发布同系列模型LLaMA2。我们在第四章已经学习了解的了LLM记忆如何训练LLM等等。那本小节我们就来学习如何动手写一个LLaMA2模型。
LLaMA2 模型结构如下图5.0所示:
<div align='center'>
<img src="../images/5-images/LLama2.png" alt="alt text" width="100%">
<p>图 5.0 LLaMA2结构</p>
</div>
### 5.1.1 定义超参数
首先我们需要定义一些超参数,这些超参数包括模型的大小、层数、头数、词嵌入维度、隐藏层维度等等。这些超参数可以根据实际情况进行调整。

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 KiB