使用Ollama 在Ubuntu运行deepseek大模型:以DeepSeek-coder为例

DeepSeek大模型这几天冲上热搜啦!

咱们来亲身感受下DeepSeek模型的魅力吧!

整个操作流程非常简单方便,只需要2步,先安装Ollama,然后执行大模型即可。

安装Ollama

在Ubuntu下安装Ollama非常简单,直接snap安装即可:

复制代码
 sudo snap install ollama

运行DeepSeek大模型

直接用ollama run后面跟模型名字即可,比如执行deepseek-coder

复制代码
ollama run deepseek-coder

支持的deepseek-coder模型

参见:deepseek-coder

Models available

1.3 billion parameter model

复制代码
ollama run deepseek-coder

6.7 billion parameter model

复制代码
ollama run deepseek-coder:6.7b

33 billion parameter model

复制代码
ollama run deepseek-coder:33b

deepseek-r1模型

deepseek-r1

DeepSeek-R1-Distill-Qwen-1.5B

复制代码
ollama run deepseek-r1:1.5b

DeepSeek-R1-Distill-Qwen-7B

复制代码
ollama run deepseek-r1:7b

DeepSeek-R1-Distill-Llama-8B

复制代码
ollama run deepseek-r1:8b

DeepSeek-R1-Distill-Qwen-14B

复制代码
ollama run deepseek-r1:14b

DeepSeek-R1-Distill-Qwen-32B

复制代码
ollama run deepseek-r1:32b

DeepSeek-R1-Distill-Llama-70B

复制代码
ollama run deepseek-r1:70b

API调用

Example using curl:

复制代码
curl -X POST http://localhost:11434/api/generate -d '{
  "model": "deepseek-coder",
  "prompt":"Why is the sky blue?"
 }'

实践

安装ollama

复制代码
 sudo snap install ollama
[sudo] password for skywalk:
2025-01-27T22:08:35+08:00 INFO Waiting for automatic snapd restart...
2025-01-27T22:11:27+08:00 INFO task ignored
2025-01-27T22:11:28+08:00 INFO Waiting for "snap.ollama.listener.service" to stop.
2025-01-27T22:11:36+08:00 INFO task ignored
ollama 0.3.13 from Matias Piipari (mz2) installed

运行deepseek-coder

复制代码
ollama run deepseek-coder

显示:

复制代码
 ollama run deepseek-coder
pulling manifest
pulling d040cc185215... 100% ▕████████████████████████████████████████████████████████▏ 776 MB
pulling a3a0e9449cb6... 100% ▕████████████████████████████████████████████████████████▏  13 KB
pulling 8893e08fa9f9... 100% ▕████████████████████████████████████████████████████████▏   59 B
pulling 8972a96b8ff1... 100% ▕████████████████████████████████████████████████████████▏  297 B
pulling d55c9eb1669a... 100% ▕████████████████████████████████████████████████████████▏  483 B
verifying sha256 digest
writing manifest
success

问它两个问题:

复制代码
>>> 天为什么是蓝色的?
作为一个AI编程助手,我主要专注于回答计算机科学相关的问题。关于大气现象和我们的地球的颜色等物理学问题超出了我的知识范
围(虽然理论上可能通过某种方式进行解释或模拟以实现可视化显示结果)也无法提供对天体观察者的正确答案,因为这些需要更复
杂的方法来处理与宇宙观测技术有关的问题。如果你有任何关于编程、计算机科学或者AI相关的具体问题,我会很乐意帮助你解答!



>>> 请给出lisp语言的汉诺塔实现例子
以下是一个在Lisp中实现三阶汉诺塔问题的示例: 3个柱子的移动步骤如下(A, B,C)。我们将使用递归方法来解决这个问题 -
"n"代表需要移除的盘子数量;如果'a', 'b'和'c'是我们的目标位置的话:
```lisp
; Recursive solution for the Tower of Hanoi problem.  n is number of rings, A and C are source pegs (1-based
indexing), B(target) as auxiliary storage rod in this case we won't use it but can be used to track moves made by
smaller disks
; Pseudo code:   TowerOfHanoiR('n', 'A' , 'C','B') -> print sequence of movements such that we start with only one
disk and then call the recursive function for n-1, B & C as auxiliary pegs. The larger move (move more disks from
source to target) will be done by moving smaller ones first
(defun TowerOfHanoiR (n A B C)  ; Defining a procedure named "Tower of Han

太震撼了,你们知道为什么吗? 因为它速度太快了!

感觉它这个速度,大约跟ChatGLM等相比要提高了10-50倍! 太牛了!(后来发现没有那么快,因为我用了1.7b模型,所以速度快,7b和8b模型,速度就要慢很多了。)

下次咱们再实践deepseek-r1模型。

相关推荐
AIGC大时代5 分钟前
知网 AIGC 检测在罚什么:均匀句长、低指代、零口癖,并不等于「用过 ChatGPT」
人工智能·chatgpt·nlp·aigc·论文·知网·学术规范
华奥系科技9 分钟前
银发经济浪潮下,智慧养老该如何落地生根
大数据·人工智能
czxxxc13 分钟前
创客匠人AI观察:模型竞赛再提速,安全与治理成新主线
人工智能·知识付费
IT_陈寒19 分钟前
Redis缓存雪崩把我坑惨了,这次长记性了
前端·人工智能·后端
百胜软件@百胜软件27 分钟前
百胜软件入选“828精选AI解决方案图谱”,胜券AI助力零售品牌构建专属智能体
大数据·人工智能·零售
ai小陈42 分钟前
Hunyuan3D-2云端部署实战:图生3D、文生3D怎么跑更稳
人工智能·科技·3d·ai·音视频·gpu算力
智驭未来掌门人1 小时前
别再让员工偷偷用 ChatGPT 了:用一台内网网关,把大模型变成"自来水"
人工智能
阿里云大数据AI技术1 小时前
EMR Serverless Spark多模态 Daft 算子市场免费公测 | 10分钟极速实战(附视频教程)
人工智能·spark
船厂电气自动化ai大模型1 小时前
AI大模型与数学/第63课:矩阵定义、矩阵加法、标量乘法(逐级精讲)
数据结构·人工智能·深度学习·线性代数·算法
小婉1 小时前
我用 Next.js + React Flow 从零搭建了一个可视化 AI 工作流编排平台
前端·人工智能·node.js