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

打印 上一主题 下一主题

主题 861|帖子 861|积分 2583

DeepSeek大模型这几天冲上热搜啦!
咱们来亲身感受下DeepSeek模型的魅力吧!
整个操作流程非常简单方便,只必要2步,先安装Ollama,然后执行大模型即可。
安装Ollama

在Ubuntu下安装Ollama非常简单,直接snap安装即可:
  1. sudo snap install ollama
复制代码
运行DeepSeek大模型

直接用ollama run后面跟模型名字即可,比如执行deepseek-coder
  1. ollama run deepseek-coder
复制代码
支持的deepseek-coder模型

参见:deepseek-coder
Models available

1.3 billion parameter model
  1. ollama run deepseek-coder
复制代码
6.7 billion parameter model
  1. ollama run deepseek-coder
  2. :6.7b
复制代码
33 billion parameter model
  1. ollama run deepseek-coder
  2. :33b
复制代码
deepseek-r1模型

deepseek-r1
DeepSeek-R1-Distill-Qwen-1.5B
  1. ollama run deepseek-r1:1.5b
复制代码
DeepSeek-R1-Distill-Qwen-7B
  1. ollama run deepseek-r1:7b
复制代码
DeepSeek-R1-Distill-Llama-8B
  1. ollama run deepseek-r1:8b
复制代码
DeepSeek-R1-Distill-Qwen-14B
  1. ollama run deepseek-r1:14b
复制代码
DeepSeek-R1-Distill-Qwen-32B
  1. ollama run deepseek-r1:32b
复制代码
DeepSeek-R1-Distill-Llama-70B
  1. ollama run deepseek-r1:70b
复制代码

API调用

Example using curl:
  1. curl -X POST http://localhost:11434/api/generate -d '{
  2.   "model": "deepseek-coder",
  3.   "prompt":"Why is the sky blue?"
  4. }'
复制代码
 实践

安装ollama

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

  1. ollama run deepseek-coder
复制代码
表现:
  1. ollama run deepseek-coder
  2. pulling manifestpulling d040cc185215... 100% ▕████████████████████████████████████████████████████████▏ 776 MBpulling a3a0e9449cb6... 100% ▕████████████████████████████████████████████████████████▏  13 KBpulling 8893e08fa9f9... 100% ▕████████████████████████████████████████████████████████▏   59 Bpulling 8972a96b8ff1... 100% ▕████████████████████████████████████████████████████████▏  297 Bpulling d55c9eb1669a... 100% ▕████████████████████████████████████████████████████████▏  483 Bverifying sha256 digestwriting manifestsuccess
复制代码
问它两个问题:
  1. >>> 天为什么是蓝色的?
  2. 作为一个AI编程助手,我主要专注于回答计算机科学相关的问题。关于大气现象和我们的地球的颜色等物理学问题超出了我的知识范
  3. 围(虽然理论上可能通过某种方式进行解释或模拟以实现可视化显示结果)也无法提供对天体观察者的正确答案,因为这些需要更复
  4. 杂的方法来处理与宇宙观测技术有关的问题。如果你有任何关于编程、计算机科学或者AI相关的具体问题,我会很乐意帮助你解答!
  5. >>> 请给出lisp语言的汉诺塔实现例子
  6. 以下是一个在Lisp中实现三阶汉诺塔问题的示例: 3个柱子的移动步骤如下(A, B,C)。我们将使用递归方法来解决这个问题 -
  7. "n"代表需要移除的盘子数量;如果'a', 'b'和'c'是我们的目标位置的话:
  8. ```lisp
  9. ; Recursive solution for the Tower of Hanoi problem.  n is number of rings, A and C are source pegs (1-based
  10. indexing), B(target) as auxiliary storage rod in this case we won’t use it but can be used to track moves made by
  11. smaller disks
  12. ; Pseudo code:   TowerOfHanoiR('n', 'A' , ‘C','B') -> print sequence of movements such that we start with only one
  13. disk and then call the recursive function for n-1, B & C as auxiliary pegs. The larger move (move more disks from
  14. source to target) will be done by moving smaller ones first
  15. (defun TowerOfHanoiR (n A B C)  ; Defining a procedure named "Tower of Han
复制代码
太震撼了,你们知道为什么吗? 因为它速率太快了!
感觉它这个速率,约莫跟ChatGLM等相比要提高了10-50倍! 太牛了!(后来发现没有那么快,因为我用了1.7b模型,以是速率快,7b和8b模型,速率就要慢很多了。)
下次咱们再实践deepseek-r1模型。


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

宝塔山

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表