在MBP上运行推理LLaMA-7B&13B模型
在MBP上运行推理LLaMA-7B模型
build this repo
# build this repo
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
obtain the original LLaMA model weights and place them in ./models
# obtain the original LLaMA model weights and place them in ./models
ls ./models
65B 30B 13B 7B tokenizer_checklist.chk tokenizer.model

install Python dependencies
# install Python dependencies
python3 -m pip install torch numpy sentencepiece
convert the 7B model to ggml FP16 format
# convert the 7B model to ggml FP16 format
python3 convert-pth-to-ggml.py models/7B/ 1


# quantize the model to 4-bits
./quantize.sh 7B
quantize the 7B model to 4-bits



量化完之后,模型从15G降低为4G。
convert the 13B model to ggml FP16 format
# convert the 13B model to ggml FP16 format
python3 convert-pth-to-ggml.py models/13B/ 1

quantize the 13B model to 4-bits
# quantize the model to 4-bits
./quantize.sh 13B


run the inference
# run the inference
./main -m ./models/7B/ggml-model-q4_0.bin -t 8 -n 128

互动模式
如果您想要更像ChatGPT的体验,您可以通过传递-i作为参数在交互模式下运行。在此模式下,您始终可以通过按Ctrl+C来中断生成,并输入一行或多行文本,这些文本将被转换为令牌并附加到当前上下文中。您还可以使用参数-r "reverse prompt string"指定反向提示。每当在生成中遇到反向提示字符串的确切令牌时,这将导致用户输入被提示。一个典型的用途是使用提示,使LLaMa模拟多个用户之间的聊天,比如Alice和Bob,并通过-r "Alice:"
这是一个用命令调用的交互示例:
./main -m ./models/7B/ggml-model-q4_0.bin -t 8 -n 256 --repeat_penalty 1.0 --color -i -r "User:" \
-p \
"Transcript of a dialog, where the User interacts with an Assistant named Bob. Bob is helpful, kind, honest, good at writing, and never fails to answer the User's requests immediately and with precision.
User: Hello, Bob.
Bob: Hello. How may I help you today?
User: Please tell me the largest city in Europe.
Bob: Sure. The largest city in Europe is Moscow, the capital of Russia.
User:"



在MBP上运行推理LLaMA-7B&13B模型的更多相关文章
- 如何实现在Windows上运行Linux程序,附示例代码
微软在去年发布了Bash On Windows, 这项技术允许在Windows上运行Linux程序, 我相信已经有很多文章解释过Bash On Windows的原理, 而今天的这篇文章将会讲解如何自己 ...
- 在传统.NET Framework 上运行ASP.NET Core项目
新的项目我们想用ASP.NET Core来开发,但是苦于我们历史的遗产很多,比如<使用 JavaScriptService 在.NET Core 里实现DES加密算法>,我们要估计等到.N ...
- Hyper-V上运行的Linux虚拟机验证是否安装了集成服务
Hyper-V上运行的Linux虚拟机验证是否安装了集成服务 ps aux|grep "hv"root 311 0.0 0.0 0 0 ? ...
- 通过Mono 在 Heroku 上运行 .NET 应用
英文原文:Running .NET on Heroku 中文原文:在 Heroku 上运行 .NET 应用 自从加入了Heroku之后,我就想在这个平台上运行.NET程序.现在我很高兴向大家宣布,我们 ...
- Linux上运行NET
今天尝试了下Ubuntu上运行NET程序,按照 https://github.com/aspnet/Home 的指引,一步一步来: 1.安装DNVM(原名KVM) Linux控制台下输入 curl - ...
- Mono 4.0 Mac上运行asp.net mvc 5.2.3
Mono 4.0 已经发布,二进制包已经准备好,具体的发布说明参见:http://www.mono-project.com/docs/about-mono/releases/4.0.0/. 今天在Ma ...
- ASP.NET Core 中文文档 第二章 指南(5) 在 Nano Server 上运行ASP.NET Core
原文 ASP.NET Core on Nano Server 作者 Sourabh Shirhatti 翻译 娄宇(Lyrics) 校对 刘怡(AlexLEWIS).许登洋(Seay).谢炀(kile ...
- 【无私分享:ASP.NET CORE 项目实战(第十章)】发布项目到 Linux 上运行 Core 项目
目录索引 [无私分享:ASP.NET CORE 项目实战]目录索引 简介 ASP.Net Core 给我们带来的最大的亮点就是跨平台,我在我电脑(win7)上用虚拟机建了个 CentOS7 ,来演示下 ...
- 玩儿转物联网IoT - 在Beagle Bone Black上运行node.js 程序
物联网(IoT)技术方兴未艾,智能手环,智能血压计,智能眼镜甚至智能鞋垫都开始进入我们的生活,各种智能设备层出不穷,世界已经到了一个"人有多大胆,地有多大产"的时代,不玩儿点物联网 ...
- 不装mono,你的.NET程序照样可以在Linux上运行!
让.NET应用程序在linux上运行,目前通用的做法就是在Linux上安装mono,然后通过”mono your.exe“命令运行这个程序. 这种运行.net程序的办法有两个弱点,一个是需要客户机安装 ...
随机推荐
- 记一次pip/pip3安装uwsgi报错
背景 本来是想着在centos 7.9的主机上面部署一个flask应用,采用的方式是linux+nginx+uwsgi来进行发布,其他的都没有问题,但是在使用pip安装uwsgi时报错了,安装不成功, ...
- CentOS 7.6 内网穿透服务lanproxy部署
在很多场景下内网穿透都是我们常常遇到的需求,之前也用过花生壳.ngrok.FRP 等等一些工具,但是由于限速.收费.安全各方面因素只好放弃了. 近期无意间看到 「传送门:lanproxy」 这款开源工 ...
- dotnet core微服务框架Jimu介绍
jimu是一个基于.Net6.0 简单易用的微服务框架,参考了很多开源库以及想法,使用了大量的开源库(如 DotNetty, consul.net, Flurl.Http, Json.net, Log ...
- 工作中的技术总结_JAVA_AA-00001 关于Session的使用 _20210825
AA-00001 关于Session的使用 _20210825 Session Java 中的Session:javax.servlet.http.HttpSession; 应用: 在我自己的项目中 ...
- 浅析Mongodb注入
前言 不太会Mongodb的用法,这里学习一下 简单介绍 Mongodb是非关系型数据库(NoSQL),在 MySQL 中,我们所熟知的几个最常见的概念是数据库 (Database).表 (Table ...
- shell脚本安装卸载统一脚本
#!/bin/bash set -e OUT_DIR=out function usage() { cat - <<-EOF SlightShift-SPB Kit Usage: $0 & ...
- Nuxt.js 应用中的 listen 事件钩子详解
title: Nuxt.js 应用中的 listen 事件钩子详解 date: 2024/11/9 updated: 2024/11/9 author: cmdragon excerpt: 它为开发者 ...
- Maven打包项目的精准指定——流程管理
作用 Maven不仅可以进行依赖管理的自动化,还可以自动化实现编译,打包,发布,等,也被成为构建流程 生命周期(lifecycle) 构成 Maven生命周期本身可以看做一个集合,在这个集合中包含了一 ...
- Gitlab运维操作
部署 安装Postfix以发送通知邮件 yum install postfix 将postfix服务设置成开机自启动 systemctl enable postfix 启动postfix system ...
- 使用yt-dlp下载youtube高清2k 60fps视频
只演示windows下的操作,linux和mac应该差不多的命令行. 首先放上github仓库地址:https://github.com/yt-dlp/yt-dlp 它的介绍: 厉害啊,支持数千个网站 ...