1.安装
官方地址:https://ollama.com/
1.1 下载ollama

1.2 安装

1.3 运行 Ollama


1.4 测试ollama运行状态

curl http://localhost:11434/api/generate -d "{ \"model\": \"qwen2:0.5b\", \"prompt\": \"Who r u?\" ,\"stream\":false}"
C:\Users\Administrator>curl http://localhost:11434/api/generate -d "{ \"model\": \"qwen2:0.5b\", \"prompt\": \"Who r u?\" ,\"stream\":false}"
{"error":"model \"qwen2:0.5b\" not found, try pulling it first"}
1.5 拉取qwen2模型
查看可用模型列表

拉取qwen2
qwen2 的 0.5b 、1.5b、7b 和 72b 的模型大小分别是 352M、935M、4.4G 和 41G
ollama run qwen2:0.5b

查询当前下载的模型

1.6 测试模型
ollama run qwen2:0.5b

1.7 本机访问
curl http://localhost:11434/api/generate -d "{ \"model\": \"qwen2:0.5b\", \"prompt\": \"Who r u?\"}"

curl http://localhost:11434/api/generate -d "{ \"model\": \"qwen2:0.5b\", \"prompt\": \"Who r u?\" ,\"stream\":false}"

1.8 局域网访问
环境变量 配置 OLLAMA_HOST,0.0.0.0, 然后重启ollama

局域网访问
