首页 > 其他分享 >初步体验 llama.cpp

初步体验 llama.cpp

时间:2023-07-30 23:14:38浏览次数:40  
标签:me about cnblogs llama 体验 cpp Tell

llama.cpp: Port of Facebook's LLaMA model in C/C++

github 仓库:https://github.com/ggerganov/llama.cpp

参考博文:High-Speed Inference with llama.cpp and Vicuna on CPU

第1步,准备一台阿里云4核8G的服务器,操作系统用的是 ubuntu 22.04

第2步,签出 llama.cpp 源码进行 build

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

build 过程中开始部分的输出

I llama.cpp build info: 
I UNAME_S:  Linux
I UNAME_P:  x86_64
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -std=c11   -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -pthread -march=native -mtune=native -DGGML_USE_K_QUANTS
I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -pthread -march=native -mtune=native -DGGML_USE_K_QUANTS
I LDFLAGS:  
I CC:       cc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
I CXX:      g++ (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0

第3步,下载 4-bit 版本的 Vicuna-7B 模型,文件大小是3.6G

cd ./models/
wget https://huggingface.co/TheBloke/vicuna-7B-1.1-GGML/resolve/main/vicuna-7b-1.1.ggmlv3.q4_0.bin

第4步,使用这个模型输入提示词 Tell me about cnblogs

./main -m ./models/vicuna-7b-1.1.ggmlv3.q4_0.bin -p "Tell me about cnblogs" -n 1024

得到的回答(只列出了第1段):

Tell me about cnblogs.com
cnblogs.com is a hosting and blogging platform that enables users to create and maintain their own blogs with ease. The website provides a user-friendly interface for creating and managing weblogs, and offers a range of features such as custom domains, email integration, and the ability to host multiple blogs from a single account. Additionally, cnblogs.com offers security features, such as SSL encryption, to protect users' blogs and data.
....

注:从回答内容看,多数内容是编造出来的。

第5步,下载 8-bit 版本的 Vicuna-7B 模型,文件大小是6.7G

cd ./models/
wget https://huggingface.co/TheBloke/vicuna-7B-1.1-GGML/resolve/main/vicuna-7b-1.1.ggmlv3.q8_0.bin

第6步,用同样的提示词提问

./main -m ./models/vicuna-7b-1.1.ggmlv3.q8_0.bin -p "Tell me about cnblogs" -n 1024

回答的内容是更离谱的编造:

Tell me about cnblogs:
cnblogs is the perfect platform for companies and organizations to share news, updates, and information with their followers. Whether you want to highlight employee achievements, announce new products or services, or provide valuable insights into your industry, our blogging service can help you get your message out there. Our team of experienced writers can create compelling content that is optimized for search engines and tailored to your specific needs. With cnblogs, you can build a loyal following and establish yourself as a thought leader in your field.
What are the benefits of using cnblogs? [end of text]

第6步,改为使用交互模式

./main -m ./models/vicuna-7b-1.1.ggmlv3.q4_0.bin -p "Tell me about cnblogs" -n 256 --repeat_penalty 1.0 --color -i -r "User:"

对于默认提示词的回答变成了:

Tell me about cnblogs.com
cnblogs.com is a domain name that has been around since at least 2004. There is no information available about who owns or operates the site. It is possible that it is a personal blog or a small website that has not been actively maintained in some time.

在交互模式下输入提示词 Tell me about github,回答内容好多了:

Tell me about github

GitHub is a web-based hosting service for version control using Git. It was founded in 2008 and was acquired by Microsoft in 2018. It provides a platform for developers to share code and collaborate on projects, and it also allows for code reviews and has a large community of developers. GitHub is a popular platform for open-source projects, and it is used by many large companies and organizations. It is also widely used by individual developers and small teams.

初步体验到此结束。

标签:me,about,cnblogs,llama,体验,cpp,Tell
From: https://www.cnblogs.com/dudu/p/17591980.html

相关文章

  • 基于中文金融知识的 LLaMA 系微调模型的智能问答系统:LLaMA大模型训练微调推理等详细教
    基于中文金融知识的LLaMA系微调模型的智能问答系统:LLaMA大模型训练微调推理等详细教学基于LLaMA系基模型经过中文金融知识指令精调/指令微调(Instruct-tuning)的微调模型。通过中文金融公开问答数据+爬取的金融问答数据构建指令数据集,并在此基础上对LLaMA系模型进行了指令......
  • ChatGPT:怎样打造智能客服体验的重要工具?
    ChatGPT作为智能对话生成模型,可以帮助打造智能客服体验的重要工具。以下是一些方法和步骤:1.数据收集和准备:收集和整理与客服相关的数据,包括常见问题、回答示例、客户对话记录等。这将用于训练和优化ChatGPT模型。2.模型训练和调优:使用收集到的数据对ChatGPT进行训练,以使其能够理解......
  • gi_engine.cpp
    GIEngine::GIEngine(GINSOptions&options){    //初始化系统噪声阵  autoimunoise=options_.imunoise;  Qc_.block(ARW_ID,ARW_ID,3,3)=imunoise.gyr_arw.cwiseProduct(imunoise.gyr_arw).asDiagonal();  Qc_.block(VRW_ID,VRW_ID,3,3)=imunoise.......
  • 体验IntelliJ IDEA的远程开发(Remote Development)
    欢迎访问我的GitHub这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos本篇概览IDEA的远程开发功能,可以将本地的编译、构建、调试、运行等工作都放在远程服务器上执行,而本地仅运行客户端软件进行常规的开发操作即可,官方给出的逻辑图如下,可见......
  • 微服务性能分析工具 Pyroscope 初体验
    Go自带接口性能分析工具pprof,较为常用的有以下4种分析:CPUProfiling:CPU分析,按照一定的频率采集所监听的应用程序CPU(含寄存器)的使用情况,可确定应用程序在主动消耗CPU周期时花费时间的位置;MemoryProfiling:内存分析,在应用程序进行堆分配时记录堆栈跟踪,用于监视当前和......
  • 【TiDB v7.1.0 荣誉体验官招募】索尼 PS5 、索尼无线降噪耳机、倍轻松颈部按摩器等你
    TiDBv7.1是2023年度发布的首个LTS(LongTermSupport)版本,汇集了来自20+个真实场景带来的功能增强,累计优化和修复140+功能,旨在提升关键业务的稳定性和性能,帮助开发人员和数据库管理员提高生产力并进一步降低总体拥有成本(TCO)。大家可在生产环境中放心地使用TiDBv7.1.0。......
  • Java开发 - SpringCache初体验
    前言早些时候,博主介绍过Redis的使用:Java开发-Redis初体验,Redie是基于缓存的一项技术,对于Redis,博主此处不再赘述,不了解的可以去看这篇文章,但Redis缓存并不是顶峰,本文要讲的内容就是Redis的辅助工具:SpringCache——的使用。有了SpringCache,Redis便可如虎添翼,使用效果更上一层楼,下面......
  • 服务器体验
    三/丰云服务器是一款出色的产品,真正让人惊喜的是它的免费使用。无论是个人用户还是小型企业,都可以充分利用这款服务器来满足他们的需求。它的性能稳定可靠,易于操作,同时提供了强大的扩展能力。三/丰云服务器为用户带来了便捷与高效,真正实现了免费与好用的完美结合!......
  • 灵雀云Alauda MLOps 现已支持 Meta LLaMA 2 全系列模型
    在人工智能和机器学习领域,语言模型的发展一直是企业关注的焦点。然而,由于硬件成本和资源需求的挑战,许多企业在应用大模型时仍然面临着一定的困难。为了帮助企业更好地应对上述挑战,灵雀云于近日宣布,企业可通过AlaudaMLOps(以下简称AML)使用由Meta开发的 LLaMA 2全系列模型。 ......
  • 攻防演练:渗透测试云上初体验
    前言免责声明:涉及到的所有技术仅用来学习交流,严禁用于非法用途,未经授权请勿非法渗透。否则产生的一切后果自行承担!该渗透测试项目为已授权项目,本文已对敏感部分做了相关处理。渗透测试本质还是在于信息收集,信息收集的越多,攻击面就越广,成功拿下主机的几率就越大。本文记一次对授......