Ollama 是一个基于llama.cpp的高层封装工具,它提供了简单的方式来加载和使用各种预训练的语言模型,支持文本生成、翻译、代码编写、问答等多种自然语言处理任务。
核心功能与特点
curl -fsSL https://ollama.com/install.sh | sh
该操作依次执行安装Ollama、创建用户、创建Ollama系统服务 以及 启动服务等操作。
也可以本地构建Ollama,请参考 官方文档。
ollama pull deepseek-r1:1.5b
该操作会下载deepseek蒸馏得到的Qwen 1.5B模型,并对模型进行sha256
校验。
pulling manifest
pulling aabd4debf0c8... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 1.1 GB
pulling 369ca498f347... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 387 B
pulling 6e4c38e1172f... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 1.1 KB
pulling f4d24e9138dd... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 148 B
pulling a85fe2a2e58e... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 487 B
verifying sha256 digest
writing manifest
success
执行命令 ollama run xxx_model
会直接运行模型,如本地没有模型缓存会自动通过互联网下载模型文件并运行。
radxa@orion-o6:~$ ollama run deepseek-r1:1.5b
>>> tell me a story about Ollama in 128 words
<think>
Okay, so I need to write a 128-word story about Ollama. Hmm, where do I start? I'm not super familiar with the Ollama AI, but from what I know, it's another conversational AI that can understand and
generate text in various languages. It might be used for creative writing or storytelling.
I wonder who would be interested in such a story. Maybe a writer looking for a fun, ……
输入\bye
可退出模型运行。
执行命令 ollama show deepseek-r1:1.5b
可显示模型的名称、参数量、上下文长度配置、量化格式等信息。
radxa@orion-o6:~$ ollama show deepseek-r1:1.5b
Model
architecture qwen2
parameters 1.8B
context length 131072
embedding length 1536
quantization Q4_K_M
Parameters
stop "<|begin▁of▁sentence|>"
stop "<|end▁of▁sentence|>"
stop "<|User|>"
stop "<|Assistant|>"
License
MIT License
Copyright (c) 2023 DeepSeek
运行 ollama list
。
ollama listradxa@orion-o6:~$ ollama list
NAME ID SIZE MODIFIED
deepseek-r1:1.5b a42b25d8c10a 1.1 GB 29 minutes ago
radxa@orion-o6:~$ ollama ps
NAME ID SIZE PROCESSOR UNTIL
deepseek-r1:1.5b a42b25d8c10a 1.6 GB 100% CPU About a minute from now
ollama stop deepseek-r1:1.5b
ollama rm deepseek-r1:1.5b
更多关于 Ollama 的详细资料,请参考 官方文档