diff --git a/README.md b/README.md index fd38fd1e6917508ce1ee331b3c98a12f618e9443..b91d2a59b1d0b691ce0cb13e9dde1b8656173594 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # llama.cpp使用指南 ## 介绍 -llama.cpp是基于C/C++实现的LLama英文大模型接口,可以支持用户在消费者级别的CPU机器上完成开源大模型的部署和使用。 +llama.cpp是基于C/C++实现的LLaMa英文大模型接口,可以支持用户在CPU机器上完成开源大模型的部署和使用。 + llama.cpp支持多个英文开源大模型的部署,如LLaMa,LLaMa2,Vicuna等。 ## 软件架构 @@ -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软件包: +``` +yum install llama.cpp +``` +2. 需要下载开源大模型,如LLaMa、LLaMa2等。并将下载的开源大模型通过llama_convert.py进行模型量化: +``` +python3 /usr/bin/llama_convert.py model_path/ +``` +其中model_path为开源大模型的存放路径。 + +3. 启动模型,进行对话: ``` -/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 +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 | diff --git a/llama.png b/llama.png new file mode 100644 index 0000000000000000000000000000000000000000..184dbf6f0632565477d45077d926f61da1c6ee5a Binary files /dev/null and b/llama.png differ