安装驱动和CUDA
参考下面这个链接
安装NVIDIA驱动
安装过程中大概会出现下面这个报错:
an error occurred while performing building kernel modules see /var/log/nvidia-installer.log for details. unrecognized command-line option…
原因是系统gcc版本和内核gcc版本不一致,安装gcc-12
That’s an issue with the Ubuntu kernel. For whatever reasons, the ubuntu kernel team decided to use gcc-12 for kernel compilation while the 22.04 system compiler is gcc-11. Please install gcc-12 from ubuntu repo to be able to compile the nvidia modules again.
- sudo apt update
- sudo apt install gcc-12 g++-12
复制代码 并将gcc-12设置为默认编译器
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
复制代码 验证gcc版本
摆设ollama(本地)
打开ollama官网,选择linux,直接下载
ollama官网
下载完成之后,可以在官网下载模子,搜索你想下载的模子,复制右边的命令即可下载模子
ollama设置
需要修改ollama设置,如果不修改ragflow没办法访问到ollama
由于默认ollama绑定在127.0.0.1的11434端口,其他IP都拒绝
使用docker只能访问到自己不能访问到宿主机上,以是需要将ollama服务暴露给网络
方法修改如下文件:
- vim /etc/systemd/system/ollama.service
复制代码 在[Service]下继承添加如下内容,使ollama绑定到0.0.0.0的11434端口
- Environment="OLLAMA_HOST=0.0.0.0"
复制代码 填入的底子URL为
- http://host.docker.internal:11434/
复制代码 参考链接
ragflow无法访问ollama
解决linux中待机时间过长导致ollama回退到cpu处理模式的问题
笔记本电脑挂起恢复
在 Linux 上,经过一次挂起/恢复周期后,有时 Ollama 会无法发现你的 NVIDIA GPU,并回退到在 CPU 上运行。你可以通过重新加载 NVIDIA UVM 驱动来解决这个驱动程序错误,命令为 sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm。
出现这个问题后,复制下面四条命令重启ollama即可
The 999 error is a generic “unknown error” code, which isn’t super helpful.
What happens if you try removing the uvm module:
- sudo systemctl stop ollama
- sudo rmmod nvidia_uvm
- sudo modprobe nvidia_uvm
- sudo systemctl start ollama
复制代码 如何找到这个问题呢,停止ollama然后重新启动ollama就会有log出来
- sudo systemctl stop ollama
- ollama serve
复制代码 会有这些log出来,分析GPU找不到了,以是ollama又使用cpu来跑模子了
- msg="unknown error initializing cuda driver library /usr/lib/x86_64-linux-gnu/libcuda.so.550.144.03: cuda driver library init failure: 999"
- msg="no compatible GPUs were discovered"
- msg="inference compute" id=0 library=cpu variant=avx2
复制代码 解决方法参考链接
Unknown error initializing cuda driver library
摆设ragflow(docker)
搜索ragflow,在github上面clone下来
- git clone https://github.com/infiniflow/ragflow.git
复制代码 ragflow有两个镜像版本,一个迷你版,一个完整版,推荐下载完整版本
如果要下载完整版本,打开ragflow/docker/.env,把完整版本取消解释,slim版本解释
然后实行下面这条命令即可拉取镜像
- docker compose -f docker-compose.yml up -d
复制代码 完成后,在浏览器输入0.0.0.0即可打开ragflow的网页
参加ollama里的模子
ollama list,复制模子名字
如图填即可
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |