Compare commits

..
Author SHA1 Message Date
S1ro1 b878abdb8e experiment: adapt Prime to vLLM scale-out package move 2026-07-22 18:41:29 -07:00
S1ro1 abb8a2a996 experiment: pin baked NVFP4 validation image 2026-07-22 16:35:36 -07:00
8 changed files with 34 additions and 16 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ jobs:
# 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
file: ./Dockerfile.nvfp4-e2e-overlay
push: true
platforms: ${{ matrix.platform }}
tags: |
+19
View File
@@ -0,0 +1,19 @@
ARG BASE_IMAGE=ghcr.io/primeintellect-ai/prime-rl@sha256:823eea93b07b5adbaaafddacdc00a7d0f7384c65696b952b92ff28b5790af6b7
FROM ${BASE_IMAGE}
USER root
# Keep Prime main and the pinned NVFP4 runtime from the immutable dev2 image.
# This layer only adapts Prime to vLLM's scale-out package move and fixes the
# persistent-cache wrapper; 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
COPY --chown=appuser:appuser \
src/prime_rl/utils/client.py \
/app/src/prime_rl/utils/client.py
COPY --chown=appuser:appuser \
k8s/experiments/run_nvfp4_inference.sh \
/app/k8s/experiments/run_nvfp4_inference.sh
USER appuser
@@ -5,7 +5,8 @@ imagePullSecrets:
image:
repository: ghcr.io/primeintellect-ai/prime-rl
tag: nvfp4-e2e.dev1-arm64
tag: nvfp4-e2e.dev2-arm64
digest: sha256:823eea93b07b5adbaaafddacdc00a7d0f7384c65696b952b92ff28b5790af6b7
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,
+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)