Mac pro M2 ---“本地部署chatGPT”

        

目录

一、打开终端

二、模型下载 

坑1:你git不下来

三、安装pytorch依赖,转换模型格式

坑2:当时是python3 quantize.py 7B,但是执行完一直出错

 四、设置对话模型,给他起个名字

 五、LLaMA资料补充


        对于有些小可爱不会上网,不知道如何注册,FaceBook发布了基于LLM的人工智能大语言模型LLaMA,本地就可以部署

Supported platforms:

  •  Mac OS
  •  Linux
  •  Windows (via CMake)
  •  Docker

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

小白操作跟紧咯,昨天踩了坑了,今天帮你们规避一下风险。

一、打开终端

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

现在ls看一下我们的文件夹里面有什么

二、模型下载 

git clone https://huggingface.co/nyanko7/LLaMA-7B

坑1:你git不下来

必须有解决方法,  我开始谷歌了一个方法:把https改成http,还是git不下来,点击链接,进去下载

     随后在models目录建立模型子目录7B:

mkdir 7B

此时 ls 看一下文件目录

 你会少几个文件,是因为我跑完了才截的图,现在你目前有的文件放到他对应的位置上。

三、安装pytorch依赖,转换模型格式

# install Python dependencies
python3 -m pip install torch numpy sentencepiece

# convert the 7B model to ggml FP16 format
python3 convert-pth-to-ggml.py models/7B/ 1

此时的输出应该是这个样子

 将模型转换成4位格式

坑2:当时是python3 quantize.py 7B,但是执行完一直出错

我咨询了chatgpt,给的方法全部都用了,但是没有什么效果。遇事不解,直接issue

error:python3 quantize.py 7B · Issue #621 · ggerganov/llama.cpp · GitHubWhen I tried the llama model and run :python3 quantize.py 7B for operation, ``` the "quantize" script was not found in the current location appeared If you want to use it from another location, set the -- quantify script path argument fr...icon-default.png?t=N7T8https://github.com/ggerganov/llama.cpp/issues/621用了大佬给的方法解决了,他也在github里面更新了相关的操作:

# quantize the model to 4-bits (using method 2 = q4_0)
./quantize ./models/7B/ggml-model-f16.bin ./models/7B/ggml-model-q4_0.bin 2

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

当运行完这个,基本已经成功了。如果你想问他问题,-p 后面加的你要问的东西,例如:

./main -m ./models/7B/ggml-model-q4_0.bin -t 8 -n 256 -p "what's your name:"

 四、设置对话模型,给他起个名字

        但是,我觉得这玩意真的有点呆逼啊,估计是这玩意有点不行,自己对话凑活能用

./main -m ./models/7B/ggml-model-q4_0.bin -t 8 -n 256 --repeat_penalty 1.0 --color -i -r "sxt:" \
                                           -p \
"
sxt: Hello, jj.
jj: Hello. How may I help you today?
"

 五、LLaMA资料补充

Meta最新模型LLaMA细节与代码详解_常鸿宇的博客-CSDN博客

 这个大哥是写的真详细,看他就完了。

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值