-
Notifications
You must be signed in to change notification settings - Fork 1.6k
如何让Ollama使用GPU运行LLM模型
baixin edited this page Apr 25, 2024
·
1 revision
说明:以 GPU 模式运行 Ollama 需要有 NVIDIA 显卡支持。
我们以 Ubuntu22.04 为例(其他系统请参考:英伟达官方文档)
- 配置apt源
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
- 更新源
sudo apt-get update
- 安装工具包
sudo apt-get install -y nvidia-container-toolkit
docker run --gpus all -d -v /opt/ai/ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
docker exec -it ollama ollama run qwen:7b