大家好,2024年4月,Meta公司开源了Llama 3 AI模型,迅速在AI社区引起轰动。紧接着,Ollama工具宣布支持Llama 3,为本地部署大型模型提供了极大的便利。
本文将介绍如何利用Ollama工具,实现Llama 3–8B模型的本地部署与应用,以及通过Open WebUI进行模型交互的方法。
1.安装Ollama
使用“curl | sh”,可以一键下载并安装到本地:
$curl -fsSL https://ollama.com/install.sh | sh
>>> Downloading ollama...
######################################################################## 100.0%
>>> Installing ollama to /usr/local/bin...
>>> Creating ollama user...
>>> Adding ollama user to video group...
>>> Adding current user to ollama group...
>>> Creating ollama systemd service...
>>> Enabling and starting ollama service...
Created symlink from /etc/systemd/system/default.target.wants/ollama.service to /etc/systemd/system/ollama.service.
>>> The Ollama API is now available at 127.0.0.1:11434.
>>> Install complete. Run "ollama" from the command line.
WARNING: No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode.
可以看到,下载后Ollama启动了一个ollama系统服务。这项服务是Ollama的核心API服务,并且它驻留在内存中。通过systemctl确认服务的运行状态:
$systemctl status ollama
● ollama.service - Ollama Service
Loaded: loaded (/etc/systemd/system/ollama.service; enabled; vendor preset: disabled)
Active: active (running) since 一 2024-04-22 17:51:18 CST; 11h ago
Main PID: 9576 (ollama)
Tasks: 22
Memory: 463.5M
CGroup: /system.slice/ollama.s