前置条件
- AMD Ryzen™ 9 5900X × 24
- 128.0 GB内存、8TB SSD
- NVIDIA GeForce RTX™ 3060 12GB
- Ubuntu 24.04.4 LTS
- Linux 6.8.0-106-generic
- NVIDIA driver (open kernel) metapackage nvidia-driver-590-open
- nvidia-cuda-toolkit 12.0.140
执行步骤
1. 启用内存压缩 zram ,增加部分 CPU 占用,节约部分宝贵的内存
|
1 |
$ sudo apt install zram-config |
2. 安装 NVIDIA CUDA
|
1 |
$ sudo apt install nvidia-cuda-toolkit |
3. 编译 llama.cpp
|
1 2 3 4 5 6 7 8 9 10 11 12 |
$ apt-get update $ apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y $ git clone https://github.com/ggml-org/llama.cpp $ cmake llama.cpp -B llama.cpp/build \ -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON $ cmake --build llama.cpp/build --config Release -j --clean-first --target llama-cli llama-mtmd-cli llama-server llama-gguf-split $ cp llama.cpp/build/bin/llama-* llama.cpp |
4. 下载模型文件,国内用户去 ModelScope 魔搭社区 搜索下载,国外的 Hugging Face下载比较艰难。
5. 启动模型
|
1 2 3 4 5 6 7 8 9 10 11 |
./llama-server \ --model unsloth/NVIDIA-Nemotron-3-Super-120B-A12B-GGUF/UD-Q4_K_XL/NVIDIA-Nemotron-3-Super-120B-A12B-UD-Q4_K_XL-00001-of-00003.gguf \ --ctx-size 16384 \ --seed 3407 \ --prio 2 \ --temp 0.6 \ --top-p 0.95 \ --port 8080 \ --host 0.0.0.0 \ --fit on \ --api-key-file api-keys.txt |