Ollama:供 agent 使用的本地 LLM
指南 · AI Practice · 僅供教育 · RAM/disk 數字是概數
目標:本地備有 OpenAI-compatible endpoint,context 足夠做 tool-calling。Hermes(及類似 agent)往往拒絕 64K 以下;僅有 8K chat window 不算「agent-ready」。
使用 ollama.com 官方 installer。版本與 tag 會變;上線前請再對官方 docs。
主題摘要 · 原創圖示 · 無自動播放
1)裝 Ollama
Linux/macOS:
curl -fsSL https://ollama.com/install.sh | sh
Windows(PowerShell):
irm https://ollama.com/install.ps1 | iex
或者前往 ollama.com/download。確認 daemon:
ollama --version
curl -s http://127.0.0.1:11434/api/tags
2)Pull 支援 tool 的 model
選擇 model card 寫明 tool/function calling、又能放入 RAM 的。權重 disk 概數(非 benchmark):
- ~7-8B quantized:多數 ~4-6 GB disk;16 GB RAM 機通常可行(其他程式不要開太多)
- ~14-32B:預留 16-32 GB+ RAM 或獨立 GPU
# 例 tag:換成 ollama.com/library 目前支援 tool 的 model
ollama pull qwen2.5:14b
ollama run qwen2.5:14b
先看 model card。純 chat model 即使 token 流暢,Hermes 也不適用。
3)提高 context(Hermes ≥64K)
預設 context 多數太小。單次:
ollama run qwen2.5:14b -c 65536
長用 Modelfile(名稱自定):
FROM qwen2.5:14b
PARAMETER num_ctx 65536
ollama create my-agent -f Modelfile
ollama run my-agent
Context 愈大愈耗 RAM/VRAM。若 thrash 或 OOM,改用較小 model/較小 context;不要當 8K 足夠做多步 tools。
4)Smoke-test OpenAI-compatible API
curl http://127.0.0.1:11434/v1/models
用 hermes model 指向 custom/Ollama endpoint。先確認 base URL、model 名、普通 chat 可用,再開 gateway 或 cron。
本頁不做
- GPU driver 長篇當主文
- Leaderboard 當事實
- Cloud GPU marketplace spam