使用 Ollama 运行 ChindaLLM 4B
完成以下步骤后,ChindaLLM 4B 将在您自己的电脑上用泰语作答,既可在终端中使用,也可通过本地 API 调用。
准备: macOS、Linux 或 Windows,可容纳 2.5 GB 下载的空间,至少 4 GB 内存(建议 8 GB)。
1. 安装 Ollama
curl -fsSL https://ollama.com/install.sh | sh
Windows 请使用 ollama.com/download 的安装程序;任何系统都可用 ollama --version 确认安装成功。
2. 下载模型
ollama pull iapp/chinda-qwen3-4b
下载约 2.5 GB;完成后,ollama list 会显示 iapp/chinda-qwen3-4b:latest。
3. 在终端中对话
# 对话模式:在 >>> 后输入,输入 /bye 退出
ollama run iapp/chinda-qwen3-4b
# 只问一个问题,然后退出
ollama run iapp/chinda-qwen3-4b "ช่วยแก้สมการ 2x + 5 = 15 ให้หน่อย"
4. 在代码中调用
本地 API 的地址为 http://localhost:11434;如未运行,用 ollama serve 启动。
- curl
- Python
curl http://localhost:11434/api/chat -d '{
"model": "iapp/chinda-qwen3-4b",
"messages": [
{"role": "user", "content": "อธิบายเกี่ยวกับปัญญาประดิษฐ์ให้ฟังหน่อย"}
]
}'
import requests
def chat_with_chinda(message):
url = "http://localhost:11434/api/generate"
data = {
"model": "iapp/chinda-qwen3-4b",
"prompt": message,
"stream": False
}
response = requests.post(url, json=data)
return response.json()["response"]
print(chat_with_chinda("สวัสดีครับ"))
故障排除
Error: pull model manifest: file does not exist:模型名称输入有误,正确名称为iapp/chinda-qwen3-4b。Error: could not connect to ollama app, is it running?:用ollama serve启动服务。- 运行缓慢或内存不足:关闭不需要的程序;建议使用 8 GB 以上内存。
在提示中附上相关文本时,Chinda 4B 的回答最好;若脱离上下文询问事实(如最新新闻或统计数据),可能给出错误答案。
基准测试与许可证:ChindaLLM 4B · Ollama:iapp/chinda-qwen3-4b · 模型权重:Hugging Face