Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
LLaMA_Fastchat_pytorch
Commits
927779bc
Commit
927779bc
authored
Sep 07, 2023
by
yuguo
Browse files
update
parent
cc338b7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
README.md
README.md
+29
-11
llama模型结构.png
llama模型结构.png
+0
-0
model.properties
model.properties
+2
-0
No files found.
README.md
View file @
927779bc
#
Open and Efficient Foundation Language Models(
LLAMA
)
# LLAMA
## 论文
`LLaMA: Open and Efficient Foundation Language Models`
-
[
https://arxiv.org/abs/2302.13971
](
https://arxiv.org/abs/2302.13971
)
## 模型介绍
LLaMA,这是一个基础语言模型的集合,参数范围从7B到65B。在数万亿的tokens上训练出的模型,并表明可以专门使用公开可用的数据集来训练最先进的模型,而不依赖于专有的和不可访问的数据集。特别是,llama 13B在大多数基准测试中优于GPT-3 (175B), LLaMA 65B与最好的模型Chinchilla-70B和PaLM-540B具有竞争力。
## 模型结构
## 模型结构
LLAMA网络基于 Transformer 架构。提出了各种改进,并用于不同的模型,例如 PaLM。以下是与原始架构的主要区别:
**预归一化**
。为了提高训练稳定性,对每个transformer 子层的输入进行归一化,而不是对输出进行归一化。使用 RMSNorm 归一化函数
。
LLaMA,这是一个基础语言模型的集合,参数范围从7B到65B。在数万亿的tokens上训练出的模型,并表明可以专门使用公开可用的数据集来训练最先进的模型,而不依赖于专有的和不可访问的数据集。特别是,llama 13B在大多数基准测试中优于GPT-3 (175B), LLaMA 65B与最好的模型Chinchilla-70B和PaLM-540B具有竞争力。LLAMA网络基于 Transformer 架构。提出了各种改进,并用于不同的模型,例如 PaLM
。
**SwiGLU 激活函数 [PaLM]**
。使用 SwiGLU 激活函数替换 ReLU 非线性以提高性能。使用 2 /3 4d 的维度而不是 PaLM 中的 4d。
**旋转嵌入**
。移除了绝对位置嵌入,而是添加了旋转位置嵌入 (RoPE),在网络的每一层。
以下是llama-13B的主要网络参数配置:
以下是llama-13B的主要网络参数配置:
...
@@ -29,7 +28,18 @@ LLAMA网络基于 Transformer 架构。提出了各种改进,并用于不同
...
@@ -29,7 +28,18 @@ LLAMA网络基于 Transformer 架构。提出了各种改进,并用于不同
"vocab_size": 32000
"vocab_size": 32000
```
```
## 算法原理
以下是与原始 Transformer 架构的主要区别:
**预归一化**
。为了提高训练稳定性,对每个transformer 子层的输入进行归一化,而不是对输出进行归一化。使用 RMSNorm 归一化函数。
**SwiGLU 激活函数 [PaLM]**
。使用 SwiGLU 激活函数替换 ReLU 非线性以提高性能。使用 2 /3 4d 的维度而不是 PaLM 中的 4d。
**旋转嵌入**
。移除了绝对位置嵌入,而是添加了旋转位置嵌入 (RoPE),在网络的每一层。
## 数据集
## 数据集
我们在Fastchat目录下集成了英文对话数据集供用户快速验证:
我们在Fastchat目录下集成了英文对话数据集供用户快速验证:
./FastChat-main/playground/data/alpaca-data-conversation.json
./FastChat-main/playground/data/alpaca-data-conversation.json
...
@@ -98,8 +108,6 @@ LLAMA网络基于 Transformer 架构。提出了各种改进,并用于不同
...
@@ -98,8 +108,6 @@ LLAMA网络基于 Transformer 架构。提出了各种改进,并用于不同
tail -f log/xxx.out.log #查看输出log
tail -f log/xxx.out.log #查看输出log
tail -f log/xxx.err.log #查看错误log
tail -f log/xxx.err.log #查看错误log
## LLAMA-13B微调(无slurm,使用mpi)
## LLAMA-13B微调(无slurm,使用mpi)
### 环境配置
### 环境配置
...
@@ -151,13 +159,13 @@ pip3 install apex-0.1+gitdb7007a.dtk2210-cp38-cp38-manylinux2014_x86_64.whl(
...
@@ -151,13 +159,13 @@ pip3 install apex-0.1+gitdb7007a.dtk2210-cp38-cp38-manylinux2014_x86_64.whl(
}
}
```
```
进入节点1,根据环境修改hostfile,保证两节点文件路径一致,配置相同,修改mpi_job.sh中--mca btl_tcp_if_include enp97s0f1,enp97s0f1改为ip
-
a命令后对应节点ip的网卡名,numa可以根据当前节点拓扑更改绑定,微调命令:
进入节点1,根据环境修改hostfile,保证两节点文件路径一致,配置相同,修改mpi_job.sh中--mca btl_tcp_if_include enp97s0f1,enp97s0f1改为ip a命令后对应节点ip的网卡名,numa可以根据当前节点拓扑更改绑定,微调命令:
```
```
source mpi_job.sh
source mpi_job.sh
```
```
##
#
模型精度
## 模型精度
训练数据:
[
./FastChat-main/playground/data/alpaca-data-conversation.json
](
链接
)
训练数据:
[
./FastChat-main/playground/data/alpaca-data-conversation.json
](
链接
)
...
@@ -167,6 +175,16 @@ source mpi_job.sh
...
@@ -167,6 +175,16 @@ source mpi_job.sh
| 卡数 | 分布式工具 | 收敛性 |
| 卡数 | 分布式工具 | 收敛性 |
| :------: | :------: |:------: |
| :------: | :------: |:------: |
| 16 | deepspeed | total_loss: 0.62/150 steps |
| 16 | deepspeed | total_loss: 0.62/150 steps |
## 应用场景
### 算法类别
`自然语言处理`
### 热点应用行业
`nlp,智能聊天助手,科研`
## 源码仓库及问题反馈
## 源码仓库及问题反馈
-
https://developer.hpccube.com/codes/modelzoo/llama_torch
-
https://developer.hpccube.com/codes/modelzoo/llama_torch
...
...
llama模型结构.png
0 → 100644
View file @
927779bc
188 KB
model.properties
View file @
927779bc
# 模型唯一标识
modelCode
=
407
# 模型名称
# 模型名称
modelName
=
LLAMA_torch
modelName
=
LLAMA_torch
# 模型描述
# 模型描述
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment