ollama,免费低门槛的开源大模型推理平台
本文介绍 Ollama,一个免费开源大模型推理平台,可本地运行管理模型。含官网、GitHub 地址,Linux 和 Windows 安装命令,下载、运行等常用命令,API 调用示例,多 GPU 推理支持
·
ollama,免费低门槛的开源大模型推理平台
阅读原文
建议阅读原文,始终查看最新文档版本,获得最佳阅读体验:《ollama,免费低门槛的开源大模型推理平台》
https://docs.dingtalk.com/i/nodes/np9zOoBVBYA16qAPTEkzObKgW1DK0g6l
介绍
Ollama 是一个轻量化的大模型本地运行与管理平台,用户无需复杂配置即可在个人电脑上快速下载、部署和运行各类开源大模型。它提供统一的命令行工具与 API 接口,方便与应用程序集成,同时支持模型管理、版本控制和高效推理,帮助开发者在本地环境中灵活构建和测试 AI 应用。
官网
github网址
ollama/ollama: Get up and running with OpenAI gpt-oss, DeepSeek-R1, Gemma 3 and other models.
安装
linux
curl -fsSL https://ollama.com/install.sh | sh
Windows
winget install --id Ollama.Ollama
#安装完成后,要重新打开终端才能使用ollama命令
ollama常用命令
下载大模型
ollama pull qwen2.5vl:7b
运行大模型
ollama run qwen2.5vl:7b #ollama默认在本地环回地址上监听
将端口包括在网络上
官方文档:ollama/docs/faq.md at main · ollama/ollama
OLLAMA_HOST=0.0.0.0:11434 ollama run qwen2.5vl:7b
查询当前计算机下载了哪些大模型
查询大模型的基本信息
ollama show qwen2.5vl:7b
停止大模型
ollama stop qwen2.5vl:7b
查询当前已加载的大模型
也可以理解为当前正在运行的大模型
ollama ps
通过api调用大模型
生成一次回答
curl http://10.65.37.46:11434/api/chat -d '{
"model": "qwen2.5vl:7b",
"messages": [
{
"role": "user",
"content": "why is the sky blue?"
}
],
"stream": false
}' | jq .
完整输出:
[ubuntu@keycloak-test ~]$ curl http://10.65.37.46:11434/api/chat -d '{
"model": "qwen2.5vl:7b",
"messages": [
{
"role": "user",
"content": "why is the sky blue?"
}
],
"stream": false
}' | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1544 100 1401 100 143 259 26 0:00:05 0:00:05 --:--:-- 318
{
"model": "qwen2.5vl:7b",
"created_at": "2025-08-14T11:10:12.755802Z",
"message": {
"role": "assistant",
"content": "The sky appears blue due to a phenomenon called Rayleigh scattering. This occurs when sunlight enters the Earth's atmosphere and interacts with the molecules in the air, primarily nitrogen and oxygen. These molecules are much smaller than the wavelength of visible light, which causes the light to scatter in all directions.\n\nThe shorter wavelengths of blue and violet light are scattered more than the longer wavelengths of red and orange light. This is because the shorter wavelengths are more easily deflected by the smaller molecules. As a result, when you look at the sky, you are seeing the scattered blue light that has been reflected back to your eyes from all directions.\n\nThe scattering of blue light is more pronounced than the scattering of other colors, which is why the sky appears blue. However, during sunrise and sunset, the angle at which the sunlight enters the atmosphere is different, and the shorter wavelengths of light are more easily scattered. This causes the sky to appear reddish or orange, as the blue light is scattered away and the longer wavelengths are more prominent."
},
"done_reason": "stop",
"done": true,
"total_duration": 5394303700,
"load_duration": 37043400,
"prompt_eval_count": 26,
"prompt_eval_duration": 26298200,
"eval_count": 205,
"eval_duration": 5327213300
}
多GPU推理
ollama默认支持单节点多GPU并行推理,参考:ollama/docs/faq.md at main · ollama/ollama (github.com)
关于作者和DreamAI
关注微信公众号“AI发烧友”,获取更多IT开发运维实用工具与技巧,还有很多AI技术文档!
更多推荐
所有评论(0)