前言
开源大模型领域当前最强的无疑是 LLaMA 3!Meta 这次不仅免费公布了两个性能强悍的大模型(8B 和 70B),还计划发布一个可以与 GPT-4 对打的 400B 模型。今天,我们将介绍一种简单易懂的本地部署方法,非常适合新手!
一、安装Ollama客户端
首先我们需要安装ollama客户端程序,下载地址:【点击跳转】
进入界面点击下载,不同的操作系统选择不同的版本
下载成功后,直接点击安装
安装成功后可以在控制台直接运行:
ollama --help
Large language model runner
Usage:
ollama [flags]
ollama [command]
Available Commands:
serve Start ollama
create Create a model from a Modelfile
show Show information for a model
run Run a model
pull Pull a model from a registry
push Push a model to a registry
list List models
cp Copy a model
rm Remove a model
help Help about any command
Flags:
-h, --help help for ollama
-v, --version Show version information
Use "ollama [command] --help" for more information about a command.
二、安装webUI
LLaMA 的一个开源的 WebUI,用于本地部署和管理 LLaMA 模型。它提供了一种简单易用的界面,使开发者可以在本地机器上运行 LLaMA 模型,并对其进行配置和使用。
1、安装Docker Desktop
这里我们通过docker来安装WebUI,关于docker的安装
可以使用Docker Desktop,下载地址:【点击跳转】
根据不同的操作系统进行下载,然后进行安装,安装成功,在控制台运行:
docker --help
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Options:
--config string Location of client config files (default
"/Users/lihao/.docker")
-c, --context string Name of the context to use to connect to the
daemon (overrides DOCKER_HOST env var and
default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level
("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"/Users/lihao/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default
"/Users/lihao/.docker/cert.pem")
--tlskey string Path to TLS key file (default
"/Users/lihao/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
........
说明已经安装成功
2、安装webUI
webUI项目地址:【点击跳转】
如果使用docker安装命令如下:
CPU版本:

docker run -d -p 5001:8080 --add-host=host.docker.internal:host-gateway -v /your/data/path:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
GPU版本:
docker run -d -p 5001:8080 --gpus=all -v your/ollama/path:/root/.ollama -v your/data/path:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama
请注意上面挂载本地目录时,选择你本地实际的目录
由于我再MacOS上测试,这里用不了GPU版本,使用的是CPU版本,安装成功我们可以直接访问:http://localhost:5001
这里点击【sign up】随便输入你的邮箱和密码进行注册
登录进入主界面
这里全是英文,我们可以设置中文
3、设置语言
具体步骤:
点击齿轮
然后选择中文
4、下载模型
同样点击右上角的设置按钮
这里如果不清楚具体模型,可以点击下面的:点击这里,也可以通过下面网站来查看具体的模型。模型网址:【点击跳转】
这里我选择安装,如下:
大家可以根据自己电脑的配置情况进行下载
下载完成后重新启动webUI
回到主界面,就可以选择模型了,如下:
搭建完毕
总结
如果想深度使用Llama3,还是准备一个好的GPU环境来测试,CPU环境下还是很吃力。