通过ollama本地部署deepseek

最近公司让我们学习部署一下deepseek,看能不能扩展一些AI新业务(个人感觉我没这个实力😂),在此记录一下部署遇到的问题!!!

环境:本地下载ollama,然后通过ollama pull deepseek r1 模型,Linux服务器通过ragflow开源项目整合ollama接口实现大模型调用。

部署参考文档

https://zhuanlan.zhihu.com/p/22064512226
这篇文章从头到尾基本没什么问题,整个流程也很简单。

常见问题

下载缓慢

刚开始下载还很快,但速度会逐渐下降下来,直至几K,如果你换个网络,网速又会恢复正常,然后又逐渐下降到几K,切换多了就会报错:

C:\Users\Administrator>ollama run deepseek-r1:8b
pulling manifest
pulling 6340dc3229b0...  71% ▕███████████████████████████████████████                 ▏ 3.5 GB/4.9 GB
Error: max retries exceeded: Get "https://dd20bb891979d25aebc8bec07b2b3bbc.r2.cloudflarestorage.com/ollama/docker/registry/v2/blobs/sha256/63/6340dc3229b0d08ea9cc49b75d4098702983e17b4c096d57afbbf2ffc813f2be/data?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=66040c77ac1b787c3af820529859349a%2F20250211%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250211T013217Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=0c6d7b537de9e43849cbaf21ffd4e8dd4e21a56b19a5bf066a3e32a38526d50b": net/http: TLS handshake timeout

解决方法:写个powershell程序,指定间隔时间自动重新kill掉再pulling

while ($true) {
    $modelExists = ollama list | Select-String "deepseek-r1:7b"
    if ($modelExists) {
        Write-Host "model is ready"
        break
    }


    Write-Host "download..."
    $process = Start-Process -FilePath "ollama" -ArgumentList "run", "deepseek-r1:7b" -PassThru -NoNewWindow

    Start-Sleep -Seconds 60

    try {
        Stop-Process -Id $process.Id -Force -ErrorAction Stop
        Write-Host "kill and restart..."
    }
    catch {
        Write-Host "error"
    }
}

参考链接:https://blog.csdn.net/cy21951612/article/details/145513664

具体参数、想法优化可以让AI帮忙写代码,网上大佬杰作(膜拜🙇‍♂️):https://github.com/u-wlkjyy/ollama-fast/tree/master

docker启动ragflow报ES的错

ERROR 247 Elasticsearch http://es01:9200 is unhealthy in 120s.
Traceback (most recent call last)

具体错误:

ERROR    311 Elasticsearch http://es01:9200 is unhealthy in 120s.
Traceback (most recent call last):
  File "/ragflow/rag/svr/task_executor.py", line 737, in <module>
    main()
  File "/ragflow/rag/svr/task_executor.py", line 713, in main
    settings.init_settings()
  File "/ragflow/api/settings.py", line 168, in init_settings
    docStoreConn = rag.utils.es_conn.ESConnection()
  File "/ragflow/rag/utils/__init__.py", line 28, in _singleton
    instances[key] = cls(*args, **kw)
  File "/ragflow/rag/utils/es_conn.py", line 63, in __init__
    raise Exception(msg)
Exception: Elasticsearch http://es01:9200 is unhealthy in 120s.

解决措施:

按照官网的操作,
cd ragflow
docker compose -f docker/docker-compose.yml up -d
会导致es或infinity容器不启动。
必须如下操作
cd ragflow/docker
docker compose up -d

进入到docker目录,拉取es01镜像,不进入到docker目录下,是拉取不到es01镜像的,也就导致es01启动不了,系统监测ES健康状态异常。

posted @   MrSponge  Views(230)  Comments(0Edit  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· SpringCloud带你走进微服务的世界
点击右上角即可分享
微信分享提示