Ollama安装
安装
| Bash |
|---|
| 下载安装
https://ollama.com/download
Mac 安装:
要求macOS 14 Sonoma或更高版本
linux:
curl -fsSL https://ollama.com/install.sh | sh
windows:
要求Windows 10或更高版本
|
设备配置
MAC studio,芯片 M3 ultra,内存512GB,硬盘1T SSD,系统版本是Sequoia 15.7.1
基本命令使用
| Bash |
|---|
| # 在本地系统上启动 Ollama。
ollama serve
# 从现有模型创建一个新模型,用于定制或训练。
ollama create <new_model>
# 显示特定模型的详细信息,例如其配置和发布日期。
ollama show <model>
# 运行指定的模型,使其准备好进行交互。
ollama run <model>
# 将指定的模型下载到您的系统。
ollama pull <model>
# 列出所有已下载的模型。
ollama list
# 显示当前正在运行的模型。
ollama ps
# 停止指定的正在运行的模型。
ollama stop <model>
# 从系统中移除指定的模型。
ollama rm <model>
|
API使用
| Bash |
|---|
| # 查看模型列表
curl http://172.16.1.22:11434/api/tags | jq
# 与模型对话
curl -X POST http://172.16.1.22:11434/api/generate \
-H "Content-Type: application/json" \
-d '{
"model": "openthinker:32b",
"prompt": "为什么天空是蓝色的?",
"stream": false
}' \
-w "\n时间统计: 总时间: %{time_total}s\n"
|