update README.md.

Signed-off-by: znzjugod <zhangnan134@huawei.com>
This commit is contained in:
znzjugod 2023-12-19 07:43:39 +00:00 committed by Gitee
parent 38abebe9fd
commit 7e9a557497
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 33 additions and 7 deletions

View File

@ -1,7 +1,8 @@
# llama.cpp使用指南
## 介绍
llama.cpp是基于C/C++实现的LLama英文大模型接口可以支持用户在消费者级别的CPU机器上完成开源大模型的部署和使用。
llama.cpp是基于C/C++实现的LLaMa英文大模型接口可以支持用户在CPU机器上完成开源大模型的部署和使用。
llama.cpp支持多个英文开源大模型的部署如LLaMaLLaMa2Vicuna等。
## 软件架构
@ -31,22 +32,47 @@ yum install llama.cpp
```
2. 查看是否安装成功:
```
/usr/bin/llama_cpp_main -h
llama_cpp_main -h
```
若成功显示help信息则安装成功。
## 使用说明
1. 需要下载量化后的开源大模型如LLaMa、LLaMa2、Vicuna、GPT4All等。
2. 启动模型其中model_path为模型存放的路径
### 不使用容器
1. 需要安装llama.cpp软件包
```
/usr/bin/llama_cpp_main -m model_path --color --ctx_size 2048 -n -1 -ins -b 256 --top_k 10000 --temp 0.2 --repeat_penalty 1.1 -t 8
yum install llama.cpp
```
2. 需要下载开源大模型如LLaMa、LLaMa2等。并将下载的开源大模型通过llama_convert.py进行模型量化
```
python3 /usr/bin/llama_convert.py model_path/
```
其中model_path为开源大模型的存放路径。
3. 启动模型,进行对话:
```
llama_cpp_main -m model_path --color --ctx_size 2048 -n -1 -ins -b 256 --top_k 10000 --temp 0.2 --repeat_penalty 1.1 -t 8
```
其中model_path为量化模型的存放路径。
可通过以下命令查看命令行选项用法:
```
/usr/bin/llama_cpp_main -h
llama_cpp_main -h
```
### 使用容器
1. 拉取容器镜像:
```
docker pull hub.oepkgs.net/openeuler/llama_image
```
2. 运行容器镜像,进行对话:
```
docker run -it --security-opt seccomp=unconfined hub.oepkgs.net/openeuler/llama_image
```
### 正常启动界面
模型启动后的界面如图1所示
**图1** 模型启动界面
![输入图片说明](llama.png)
## 规格说明
本项目可支持在CPU级别的机器上进行大模型的部署和推理但是模型推理速度对硬件仍有一定的要求硬件配置过低可能会导致推理速度过慢降低使用效率。
@ -56,7 +82,7 @@ yum install llama.cpp
**表1** 模型推理速度的测试数据
| LLama-7B | Q4_0 | Q4_1 | Q5_0 | Q5_1 |
| LLaMa-7B | Q4_0 | Q4_1 | Q5_0 | Q5_1 |
|--------------------------------|------|------|------|------|
| ms/token (CPU @ Platinum 8260) | 55 | 54 | 76 | 83 |
| 模型大小 | 3.5G | 3.9G | 4.3G | 6.7G |

BIN
llama.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB