当前位置: 首页 > article >正文

llama.cpp demo

git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp

修改Makefile使能mfma参数

    MK_CFLAGS   += -mfma -mf16c -mavx
    MK_CXXFLAGS += -mfma -mf16c -mavx

安装python3依赖

cat ./requirements/requirements-convert_legacy_llama.txt

numpy~=1.26.4
sentencepiece~=0.2.0
transformers>=4.40.1,<5.0.0
gguf>=0.1.0
protobuf>=4.21.0,<5.0.0

依次pip3 install numpy/pip3 install sentencepiece/pip3 install transformers/pip3 install gguf/pip3 install protobuf

下载https://huggingface.co/4bit/Llama-2-7b-chat-hf

转换出llama-2-7b-chat.gguf

python3 convert_hf_to_gguf.py ./models/Llama-2-7b-chat-hf --outfile llama-2-7b-chat.gguf

启动

./llama-cli -m ./llama-2-7b-chat.gguf  -co -cnv -p "You are a helpful assistant."  -fa -ngl 80 -n 512

即可开始对话

== Running in interactive mode. ==
 - Press Ctrl+C to interject at any time.
 - Press Return to return control to the AI.
 - To return control without starting a new line, end your input with '/'.
 - If you want to submit another line, end your input with '\'.

 <|im_start|>system
You are a helpful assistant.<|im_end|>

> hello
Hello! How can I help you today?
<|im_end|>

>
tell me about yourself
<|im_end|>

> can you speek Chinese ?
I apologize, but I don't speak Chinese. I'm just an AI trained to assist and provide helpful responses in English. Is there anything else I can help you with?
<|im_end|>

>


另外看看是不是可以直接下载 llama-2-7b-chat.gguf

https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/tree/main


http://www.kler.cn/news/294882.html

相关文章:

  • 【H2O2|全栈】关于HTML(2)HTML基础(一)
  • 数字证书与HTTPS部署
  • 亚马逊云科技 Gen BI 2024-09-04 上海站QuickSight
  • Ajax 解决回调竞争
  • C# System.Linq提供类似SQL语法的高效查询操作
  • 吐血整理 ChatGPT 3.5/4.0 新手使用手册~ 【2024.09.03 更新】
  • 大厂嵌入式数字信号处理器(DSP)面试题及参考答案
  • 电动机制造5G智能工厂工业物联数字孪生平台,推进制造业数字化转型
  • Shell编程:正则表达式(通配符、正则概念、元字符、量词、示例等)
  • 【C++ 面试 - 新特性】每日 3 题(四)
  • 【Unity小技巧】URP管线遮挡高亮效果
  • c++标准库中对文件读写的函数与类
  • arm-linux-gnueabihf-gcc -Wall -nostdlib -c -O2 -o start.o start.s
  • 景联文科技:专业图像采集服务,助力智能图像分析
  • 关于 ubuntu系统install的cmake版本较低无法编译项目升级其版本 的解决方法
  • Vue 3中的 路由守卫:全面解析与使用教程
  • 计算机毕业设计选题推荐-茶园茶农文化交流平台-Java/Python项目实战
  • 《语文建设》
  • Map
  • C#中的各种画刷, PathGradientBrush、线性渐变(LinearGradientBrush)和径向渐变的区别
  • C++动态规划及九种背包问题
  • 结账打印--SAAS本地化及未来之窗行业应用跨平台架构
  • 828华为云征文|华为云Flexus X实例docker部署最新gitlab社区版,搭建自己的私人代码仓库
  • Python 设置跨文件的全局变量
  • C++竞赛初阶L1-15-第六单元-多维数组(34~35课)551: T456501 计算矩阵边缘元素之和
  • 利士策分享,如何规划多彩的大学生活?
  • redis中使用lua脚本
  • 在 Linux 和类 Unix 系统中,终端(Terminal)和 Shell
  • zblog自动生成文章插件(百度AI写作配图,图文并茂)
  • SpringBoot教程(十五) | SpringBoot集成RabbitMq(消息丢失、消息重复、消息顺序、消息顺序)