Utoljára aktív 1787164268

export AI_HOST="ip"; Change the drive folder.

Revízió cd507f19cd12cbbd75e9379f5fa8a30d685c0ef2

Qwen38-MTP-Ninfer-Install.md Eredeti

Install Ninfer Server for Fast Qwen3.8-27B inference

Ninfer installs are tied to a specific GPU.

Ninfer install

  • Setup file structure
  • Compile and install vcpkg
  • Compile and install curl from vcpkg
  • Install FFMPEG from Chocolatey
  • Configure Ninfer
  • Build Ninfer
  • Run ninfer-serve.exe
  • Query ninfer-serve.exe

File Structure

H:/AI/Code/ninfer-$gpu/
H:/AI/Code/Tool/vcpkg/
H:/AI/Code/Model/qwen3_8_27b.ninfer # 18GB
H:/AI/Code/Tool/cuda_13.3.1_windows # Remote drive CUDA install. Automatically sets the CUDA_PATH in Windows system env variables

Install vcpkg.exe

git clone https://github.com/Microsoft/vcpkg
git fetch --unshallow # to make sure
git pull
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg.exe integrate install
./vcpkg.exe install curl

Configure Ninfer with FFMPEG from Chocolatey and curl compiled by MSVC

cd H:/AI/Code/ninfer-4090
# Clear your build folder build-sm89 then configure.
time cmake -B build-sm89 -G "Visual Studio 17 2022" -A x64 \
  -DCMAKE_CUDA_ARCHITECTURES=89 \
  -DCMAKE_CUDA_FLAGS="--generate-code=arch=compute_89,code=sm_89" \
  -DNINFER_BUILD_APPS=ON \
  -DNINFER_BUILD_BENCHMARKS=ON \
  -DCMAKE_PREFIX_PATH="C:/Users/IT/AppData/Local/UniGetUI/Chocolatey/lib/ffmpeg-shared/tools/ffmpeg-9.0.1-full_build-shared;H:/AI/Code/Tool/vcpkg/packages/curl_x64-windows" \
  -DCMAKE_TOOLCHAIN_FILE="H:/AI/Code/Tool/vcpkg/scripts/buildsystems/vcpkg.cmake" \
  -DCOMPILE_DEFINITIONS="CURL_STATICLIB"

Build Ninfer ~20mins

time cmake --build build-sm89 --config Release --target ninfer ninfer-serve ninfer_bench --parallel 32                                                                     

Run Ninfer Server

time ./build-sm89/apps/Release/ninfer-serve.exe "H:/AI/Code/Model/qwen3_8_27b.ninfer" --kv-dtype rk4v4-e8 --spec mtp --draft-tokens 4 --lm-head-draft --max-context 220000 --preserve-thinking --host 0.0.0.0 -p 8080

Query Ninfer Server

Curl

curl http://$AI_HOST:8080/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "qwen3.8-27b",
"messages": [{"role": "user", "content": "Reply with one short sentence."}],
"max_tokens": 64
}'

Aider Chat

# aider.oai:  
alias aoai="aider.openai"
aider.openai(){

aider_files="$@"

local ai_model="qwen3.8-27b"
local ollama_api_base_aider="http://$AI_HOST:8080/v1"
local OPENAI_API_KEY="dummy"

time aider $aider_files \
  --no-show-model-warnings \
  --model "openai/$ai_model" \
  --openai-api-base "$ollama_api_base_aider" \
	--openai-api-key "ollama" \
	--dark-mode --code-theme solarized-dark \
  --notifications --notifications-command "ssh ai minecraft.sound" --watch-files

}
# ---