Commit c36a00b4 authored by zhouxiang's avatar zhouxiang
Browse files

更新modelzoo提交格式

parent f4100f9b
# Baichuan-13B_CPP # Baichuan-13B_fastllm
## 论文 ## 论文
...@@ -8,28 +8,30 @@ https://arxiv.org/abs/2309.10305 ...@@ -8,28 +8,30 @@ https://arxiv.org/abs/2309.10305
## 模型结构 ## 模型结构
Baichuan系列模型是由百川智能开发的开源大规模预训练模型,包含7B和13B等规模。其中,Baichuan-7B在大约1.2万亿tokens上训练的70亿参数模型,支持中英双语,上下文窗口长度为4096。Baichuan-13B是由百川智能继Baichuan-7B之后开发的包含130亿参数模型,它在高质量的语料上训练了1.4万亿tokens,超过LLaMA-13B 40%,是当前开源 13B 尺寸下训练数据量最多的模型。此外,百川智能还发布了对齐模型(Baichuan-13B-Chat),具有很强的对话能力。 Baichuan-13B是由百川智能继Baichuan-7B之后开发的包含130亿参数模型,它在高质量的语料上训练了1.4万亿tokens,超过LLaMA-13B 40%。
Baichuan 2 是百川智能推出的新一代开源大语言模型,采用 2.6 万亿Tokens 的高质量语料训练。
模型具体参数: 模型具体参数:
| 模型名称 | 隐含层维度 | 层数 | 头数 | 词表大小 | 总参数量 | 位置编码 | 最大长 | | 模型名称 | 隐含层维度 | 层数 | 头数 | 词表大小 | 位置编码 | 最大序列长度 |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Baichuan-13B | 5,120 | 40 | 40 | 64,000 | 13,264,901,120 | ALiBi | 4096 | | Baichuan-13B | 5,120 | 40 | 40 | 64000 | ALiBi | 4096 |
| Baichuan2-13B | 5,120 | 40 | 40 | 125696 | ALiBi | 4096 |
## 算法原理 ## 算法原理
Baichuan整体模型基于标准的Transformer结构,采用了和LLaMA一样的模型设计。Baichuan-13B使用了ALiBi线性偏置技术,相对于Rotary Embedding计算量更小,对推理性能有显著提升。 Baichuan整体模型基于标准的Transformer结构,采用了和LLaMA一样的模型设计。其中,Baichuan-7B在结构上采用Rotary Embedding位置编码方案、SwiGLU激活函数、基于RMSNorm的Pre-Normalization。Baichuan-13B使用了ALiBi线性偏置技术,相对于Rotary Embedding计算量更小,对推理性能有显著提升
## 模型下载
[原版模型下载]([baichuan-inc/Baichuan-13B-Chat · Hugging Face](https://huggingface.co/baichuan-inc/Baichuan-13B-Chat))
## 环境配置 ## 环境配置
### 环境准备 ### 环境准备
在光源可拉取推理的docker镜像,拉取方式如下: 在光源可拉取推理的docker镜像,拉取方式如下:
``` ```
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk-23.04-py38-latest docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk-23.04-py38-latest
``` ```
### 容器启动 ### 容器启动
模型推理容器启动命令参考如下,用户根据需要修改: 模型推理容器启动命令参考如下,用户根据需要修改:
...@@ -56,13 +58,25 @@ cd package ...@@ -56,13 +58,25 @@ cd package
python setup install python setup install
``` ```
## 数据集
## 推理
### 原版模型下载
[baichuan-inc/Baichuan-13B-Chat · Hugging Face](https://huggingface.co/baichuan-inc/Baichuan-13B-Chat)
[baichuan-inc/Baichuan2-13B-Chat · Hugging Face](https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat)
### 模型转换 ### 模型转换
``` ```
# 为了精简镜像,光源镜像中未包含模型推理时不需要的原版Baichuan-13B-chat模型运行所需要的依赖, # 为了精简镜像,光源镜像中未包含模型推理时不需要的原版Baichuan-13B-chat模型运行所需要的依赖,
# 如果有现成的原版Baichuan-13B-chat的运行环境中,可以将模型转换脚本baichuan2flm.py移动到原版模型的运行环境中, # 如果有现成的原版Baichuan-13B-chat的运行环境中,可以将模型转换脚本baichuan2flm.py移动到原版模型的运行环境中,
# 也可以通过执行pip install -r requirements.txt安装模型转换所需依赖; # 也可以通过执行pip install -r requirements.txt安装模型转换所需依赖;
# 如果使用已经下载完成的模型或者自己finetune的模型需要修改baichuan2flm.py文件中创建tokenizer, model时的模型存放路径 # 对于已经下载完成的模型或者自己finetune的模型需要修改baichuan2flm.py文件中创建tokenizer, model时的模型存放路径
# 执行: # 执行:
python3 baichuan2flm.py baichuan-13b-fp16.bin float16 # 导出fp16模型,参数为导出的模型路径 python3 baichuan2flm.py baichuan-13b-fp16.bin float16 # 导出fp16模型,参数为导出的模型路径
...@@ -71,7 +85,7 @@ python3 baichuan2flm.py baichuan-13b-int8.bin int8 # 导出fp16模型,参数 ...@@ -71,7 +85,7 @@ python3 baichuan2flm.py baichuan-13b-int8.bin int8 # 导出fp16模型,参数
``` ```
### 模型推理 ### 模型推理运行实例
``` ```
# 命令行聊天程序,使用了模型创建以及流式对话效果 # 命令行聊天程序,使用了模型创建以及流式对话效果
...@@ -97,24 +111,30 @@ chmod +x benchmark ...@@ -97,24 +111,30 @@ chmod +x benchmark
./benchmark -p ../baichuan-13b-fp16.bin -f prompts/hello.txt -b 512 -l 18 ./benchmark -p ../baichuan-13b-fp16.bin -f prompts/hello.txt -b 512 -l 18
``` ```
## 运行效果展示 ## result
![baochuan推理](baichuan-13b.gif) ![baochuan推理](baichuan-13b.gif)
### 精度
## 应用场景 ## 应用场景
### 算法类别 ### 算法类别
`自然语言处理` `对话问答`
### 热点应用行业 ### 热点应用行业
`nlp,智能聊天助手,科研` `医疗,科研,金融,教育`
## 源码仓库及问题反馈 ## 源码仓库及问题反馈
- https://developer.hpccube.com/codes/modelzoo/baichuan-13b_cpp - https://developer.hpccube.com/codes/modelzoo/baichuan-13b_fastllm
## 参考资料 ## 参考资料
- [https://github.com/baichuan-inc/Baichuan-13B](https://github.com/baichuan-inc/Baichuan-13B) - https://github.com/baichuan-inc/Baichuan-13B
\ No newline at end of file - https://github.com/baichuan-inc/Baichuan2
# 模型唯一标识 # 模型唯一标识
modelCode = 416 modelCode = 416
# 模型名称 # 模型名称
modelName=Baichuan-13B_CPP modelName=baichuan-13b_fastllm
# 模型描述 # 模型描述
modelDescription=Baichuan-13B 是由百川智能开发的包含 130 亿参数的开源可商用的大规模语言模型,在权威的中文和英文 benchmark 上均取得同尺寸最好的效果 modelDescription=Baichuan-13B 是由百川智能开发的包含 130 亿参数的开源可商用的大规模语言模型,在权威的中文和英文 benchmark 上均取得同尺寸最好的效果
# 应用场景 # 应用场景
appScenario=推理,NLP,智能聊天助手,金融,教育 appScenario=推理,对话问答,医疗,科研,金融,教育
# 框架类型 # 框架类型
frameType=cpp frameType=fastllm
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment