Compare commits

...
10 changed files with 60 additions and 17 deletions
+4 -1
View File
@@ -157,7 +157,10 @@ jobs:
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.cuda
# This experiment tag derives from the immutable current-main arm64
# image and only bakes the pinned NVFP4 runtime. Main still uses
# Dockerfile.cuda; this workflow change exists solely on the tag.
file: ./Dockerfile.nvfp4-e2e-overlay
push: true
platforms: ${{ matrix.platform }}
tags: |
+21
View File
@@ -0,0 +1,21 @@
ARG BASE_IMAGE=ghcr.io/primeintellect-ai/prime-rl@sha256:a86004b9b44d43c8018633283ec0267c3339c0dac0e35a9957f48f0a6b56153c
FROM ${BASE_IMAGE}
USER root
COPY pyproject.toml /app/pyproject.toml
COPY uv.lock /app/uv.lock
COPY scripts/patch-vllm-nvfp4-writable-scales.py /app/scripts/patch-vllm-nvfp4-writable-scales.py
COPY k8s/experiments/run_nvfp4_inference.sh /app/k8s/experiments/run_nvfp4_inference.sh
RUN uv --no-config pip install \
--python /app/.venv/bin/python \
--upgrade \
--no-deps \
'https://wheels.vllm.ai/910cc8543a6907c9cc87c417f8f2420969278bf5/vllm-0.23.1rc1.dev1392%2Bg910cc8543-cp38-abi3-manylinux_2_28_aarch64.whl' \
'https://github.com/flashinfer-ai/flashinfer/releases/download/v0.6.15.post1/flashinfer_python-0.6.15.post1-py3-none-any.whl' \
'https://github.com/flashinfer-ai/flashinfer/releases/download/v0.6.15.post1/flashinfer_cubin-0.6.15.post1-py3-none-any.whl' \
&& /app/.venv/bin/python /app/scripts/patch-vllm-nvfp4-writable-scales.py \
&& /app/.venv/bin/python -c 'from importlib.metadata import version; expected={"vllm":"0.23.1rc1.dev1392+g910cc8543","flashinfer-python":"0.6.15.post1","flashinfer-cubin":"0.6.15.post1"}; actual={name:version(name) for name in expected}; assert actual == expected, (actual, expected)'
USER appuser
+13
View File
@@ -0,0 +1,13 @@
ARG BASE_IMAGE=ghcr.io/primeintellect-ai/prime-rl@sha256:4a2713ef9f6df8f002a8e63398f408127c05588e611e655d792252ecfd627ace
FROM ${BASE_IMAGE}
USER root
# Keep Prime main, the pinned NVFP4 runtime, and the cache/package-move fixes
# from the immutable dev3 image. This layer only tracks vLLM's OnlineRenderer
# member rename; it does not install or compile anything.
COPY --chown=appuser:appuser \
src/prime_rl/inference/vllm/serving_tokens.py \
/app/src/prime_rl/inference/vllm/serving_tokens.py
USER appuser
@@ -0,0 +1,7 @@
**
!Dockerfile.nvfp4-e2e-overlay
!src/
!src/prime_rl/
!src/prime_rl/inference/
!src/prime_rl/inference/vllm/
!src/prime_rl/inference/vllm/serving_tokens.py
@@ -5,7 +5,8 @@ imagePullSecrets:
image:
repository: ghcr.io/primeintellect-ai/prime-rl
tag: nvfp4-e2e.dev1-arm64
tag: nvfp4-e2e.dev3-arm64
digest: sha256:4a2713ef9f6df8f002a8e63398f408127c05588e611e655d792252ecfd627ace
pullPolicy: IfNotPresent
devSource:
+4 -6
View File
@@ -45,12 +45,10 @@ PY
export NVFP4_CACHE_HIT=0
if [[ -f "$NVFP4_CACHE_READY_MARKER" ]] && \
[[ "$(<"$NVFP4_CACHE_READY_MARKER")" == "$NVFP4_CACHE_KEY" ]]; then
# Wheel extraction gives byte-identical CUDA sources fresh mtimes on every
# pod. Refresh cached build outputs so Ninja does not rebuild them solely
# because the source inode was recreated.
find "$FLASHINFER_WORKSPACE_BASE" \
-type f \( -name '*.so' -o -name '*.o' -o -name '*.a' \) \
-exec touch {} +
# The runtime is baked into an immutable image, so its CUDA source mtimes
# are stable across pods. Preserve Ninja's recorded output mtimes: touching
# cached objects here invalidates .ninja_log and forces the expensive
# fused-MoE translation units to rebuild.
export NVFP4_CACHE_HIT=1
echo "Reusing persistent NVFP4 JIT cache: $NVFP4_CACHE_KEY"
else
@@ -1,7 +1,7 @@
"""Prime-RL extensions to vLLM's `/inference/v1/generate` handler.
vLLM 0.22 ships a generic tokens-in / tokens-out handler at
``vllm.entrypoints.serve.disagg.serving.ServingTokens`` that already covers
``vllm.entrypoints.scale_out.token_in_token_out.serving.ServingTokens`` that already covers
prefix-cache salting, lora dispatch, multimodal features, prompt logprobs,
priority, ``data_parallel_rank`` header routing and server-side ``max_tokens``
defaulting. We subclass it for the bits still missing from the upstream handler:
@@ -37,12 +37,12 @@ from vllm.entrypoints.openai.engine.protocol import (
RequestResponseMetadata,
UsageInfo,
)
from vllm.entrypoints.serve.disagg.protocol import (
from vllm.entrypoints.scale_out.token_in_token_out.protocol import (
GenerateRequest,
GenerateResponse,
GenerateResponseChoice,
)
from vllm.entrypoints.serve.disagg.serving import ServingTokens
from vllm.entrypoints.scale_out.token_in_token_out.serving import ServingTokens
from vllm.entrypoints.serve.utils.api_utils import get_max_tokens
from vllm.outputs import RequestOutput
from vllm.sampling_params import RequestOutputKind, SamplingParams
@@ -200,7 +200,7 @@ class PrimeRlServingTokens(ServingTokens):
# Build the engine input — features-aware (MM) or text-only fallback.
# Identical to upstream so we keep tracking it.
if features := request.features:
from vllm.entrypoints.serve.disagg.mm_serde import decode_mm_kwargs_item
from vllm.entrypoints.scale_out.token_in_token_out.mm_serde import decode_mm_kwargs_item
from vllm.inputs import mm_input
from vllm.multimodal.inputs import (
MultiModalKwargsItem,
@@ -226,7 +226,7 @@ class PrimeRlServingTokens(ServingTokens):
cache_salt=request.cache_salt,
)
else:
(engine_input,) = await self.openai_serving_render.preprocess_completion(
(engine_input,) = await self.online_renderer.preprocess_completion(
request,
prompt_input=request.token_ids,
prompt_embeds=None,
+1 -1
View File
@@ -605,7 +605,7 @@ async def prefill_logprobs(openai: AsyncOpenAI, model: str, token_ids: list[int]
+ ``prompt_logprobs`` (the prime-rl server-side extension in
``inference/vllm/serving_tokens.py``). Returns one logprob per token (0.0 for
the leading token, which has no preceding context)."""
from vllm.entrypoints.serve.disagg.protocol import GenerateResponse
from vllm.entrypoints.scale_out.token_in_token_out.protocol import GenerateResponse
# `/inference/v1/generate` is mounted at server root, not under `/v1`: pass an
# absolute URL so the SDK skips the base-url merge. vLLM's `GenerateResponse`
+1 -1
View File
@@ -15,7 +15,7 @@ import asyncio
import numpy as np
import pybase64
from vllm.entrypoints.openai.engine.protocol import UsageInfo
from vllm.entrypoints.serve.disagg.protocol import GenerateResponse, GenerateResponseChoice
from vllm.entrypoints.scale_out.token_in_token_out.protocol import GenerateResponse, GenerateResponseChoice
from prime_rl.inference.vllm.routed_experts import serialize_routed_experts
from prime_rl.inference.vllm.serving_tokens import (
+2 -2
View File
@@ -96,8 +96,8 @@ def test_renderer_client_qwen3_vl_e2e_features_payload_roundtrips_through_vllm()
ClientConfig,
UserMessage,
)
from vllm.entrypoints.serve.disagg.mm_serde import decode_mm_kwargs_item
from vllm.entrypoints.serve.disagg.protocol import GenerateRequest
from vllm.entrypoints.scale_out.token_in_token_out.mm_serde import decode_mm_kwargs_item
from vllm.entrypoints.scale_out.token_in_token_out.protocol import GenerateRequest
# ── Build a real Qwen3VLRenderer with a real processor. ─────────────
tokenizer = load_tokenizer(_MODEL)