FROM vllm/vllm-openai:latest ENV PORT=7860 EXPOSE 7860 # Force unbuffered standard I/O ENV PYTHONUNBUFFERED=1 # Redirect all caches from /root to /tmp for Hugging Face UID 1000 ENV HOME=/tmp ENV HF_HOME=/tmp/huggingface ENV XDG_CACHE_HOME=/tmp/cache ENV TRITON_CACHE_DIR=/tmp/triton ENV NUMBA_CACHE_DIR=/tmp/numba # PCIe multi-GPU fixes for L40S ENV NCCL_P2P_DISABLE=1 ENV NCCL_IB_DISABLE=1 ENV MODEL_NAME="Qwen/Qwen3.8-27B-FP8" # Grant write permissions to /tmp for user 1000 USER root RUN mkdir -p /tmp/huggingface /tmp/cache /tmp/triton /tmp/numba && \ chmod -R 777 /tmp # Switch to user 1000 as required by Hugging Face Spaces USER 1000 # Use python3 module directly with 2>&1 redirection to force log visibility ENTRYPOINT ["sh", "-c", "python3 -m vllm.entrypoints.openai.api_server \ --model ${MODEL_NAME} \ --host 0.0.0.0 \ --port 7860 \ --tensor-parallel-size 4 \ --pipeline-parallel-size 2 \ --disable-custom-all-reduce \ --gpu-memory-utilization 0.90 \ --max-model-len 131072 \ --enable-chunked-prefill \ --max-num-batched-tokens 16384 \ --swap-space 4 \ --reasoning-parser qwen3 \ --speculative-config '{\"method\":\"mtp\",\"num_speculative_tokens\":2}' \ --trust-remote-code \ ${API_KEY:+--api-key $API_KEY} 2>&1"]