linux下 搭建Llama3

安装软件:
Ollama,官方网站:https://ollama.com/
可以再下载win、mac和linux版本
linux安装命令为:curl -fsSL https://ollama.com/install.sh | sh
由于我的机器是linux不联网机器,网上没找到下载离线方式,查看https://ollama.com/install.sh脚本发现有这句话:

 "https://ollama.com/download/ollama-linux-${ARCH}${VER_PARAM}"

修改为如下即可下载下来,传输到内网机器

https://ollama.com/download/ollama-linux-amd64

传输到内网机器/usr/bin/* 下,命名为ollama。运行以下修改权限:

sudo chmod +x /usr/bin/ollama

下载模型:

模型途径:
1.官网下载:https://ollama.com/library/llama3
2.Hugging Face:https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-8bit/tree/main 这里是8B的模型,可自行选择
3.国内镜像(推荐):https://hf-mirror.com/models

下载.GGUF格式模型

部署模型
进入部署机器,启动Ollama 服务

ollama serve

编写Modelfile 文件 ,FORM后改成自己模型目录

FROM /home/cec/CEMC/wpw/Llama3-70B-Chinese-Chat-q4_0.gguf
TEMPLATE """{{ if .System }}<|start_header_id|>system<|end_header_id|>
{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
{{ .Response }}<|eot_id|>"""
SYSTEM """"""
PARAMETER num_keep 24
PARAMETER stop <|start_header_id|>
PARAMETER stop <|end_header_id|>
PARAMETER stop <|eot_id|>
PARAMETER stop assistant
PARAMETER stop Assistant

创建模型实例:一个名为 llama3-zh-inst(名字可自定义)的模型实例,加载 Modelfile 配置: llama3-zh-inst为实例名,可随便取

ollama create llama3-zh-inst -f Modelfile

运行命令,开始问答

ollama run llama3-zh-inst
  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值