Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
469a4e6714 | ||
|
|
319af10769 | ||
|
|
d11fc90469 | ||
|
|
c9a4b3b199 | ||
|
|
a252057978 | ||
|
|
429c1bb5e5 | ||
|
|
efb874b734 | ||
|
|
2171368063 | ||
|
|
7b7bde1fa0 | ||
|
|
0fe673c23c | ||
|
|
84ccb9507d | ||
|
|
09e403b4a4 | ||
|
|
7da26cd651 | ||
|
|
5f2c004184 | ||
|
|
c0d896f3f8 | ||
|
|
bb522cce53 | ||
|
|
95af0118db |
@@ -199,3 +199,5 @@ debug_I2_zero_band
|
||||
.idea
|
||||
|
||||
outputs/
|
||||
|
||||
third_party/
|
||||
|
||||
@@ -16,6 +16,16 @@ class ServerConfig(BaseConfig):
|
||||
|
||||
host: Annotated[str | None, Field(description="The host to bind to.")] = None
|
||||
port: Annotated[int, Field(description="The port to bind to.")] = 8000
|
||||
liveness_timeout_seconds: Annotated[
|
||||
float,
|
||||
Field(
|
||||
gt=0,
|
||||
description=(
|
||||
"Timeout in seconds for the /liveness endpoint's internal vLLM worker RPC. "
|
||||
"If Kubernetes liveness probes are enabled, keep the probe timeoutSeconds at least this high."
|
||||
),
|
||||
),
|
||||
] = 30.0
|
||||
|
||||
|
||||
class ParallelConfig(BaseConfig):
|
||||
@@ -110,6 +120,16 @@ class WeightBroadcastConfig(BaseConfig):
|
||||
)
|
||||
|
||||
|
||||
class KVCacheOffloadConfig(BaseModel):
|
||||
"""CPU KV cache offloading for vLLM inference workers."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
cpu_bytes: Annotated[int, Field(gt=0, description="CPU bytes available for KV cache offloading per worker.")] = (
|
||||
1_000_000_000
|
||||
)
|
||||
|
||||
|
||||
# Valid vLLM max_lora_rank values (from vllm/config/lora.py)
|
||||
# TODO: on newer vLLM, can import via `get_args(vllm.config.lora.MaxLoRARanks)`
|
||||
VALID_VLLM_LORA_RANKS = (8, 16, 32, 64, 128, 256, 320, 512)
|
||||
@@ -152,20 +172,6 @@ class MultiNodeInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
|
||||
] = "consistent_hash"
|
||||
|
||||
|
||||
class KVCacheOffloadConfig(BaseModel):
|
||||
"""CPU KV cache offloading for disaggregated serving.
|
||||
|
||||
When configured, both prefill and decode nodes use
|
||||
MultiConnector (NixlConnector + OffloadingConnector).
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
cpu_bytes: Annotated[int, Field(ge=0, description="CPU bytes available for KV cache offloading per worker.")] = (
|
||||
1_000_000_000
|
||||
)
|
||||
|
||||
|
||||
class DisaggregatedInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
|
||||
"""Configures a disaggregated prefill/decode inference deployment.
|
||||
|
||||
@@ -214,11 +220,6 @@ class DisaggregatedInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
|
||||
Field(description="Extra environment variables exported only on decode nodes."),
|
||||
] = {}
|
||||
|
||||
kv_cache_offload: Annotated[
|
||||
KVCacheOffloadConfig | None,
|
||||
Field(description="CPU KV cache offload config for prefill nodes. None = disabled (NixlConnector only)."),
|
||||
] = None
|
||||
|
||||
@property
|
||||
def num_nodes(self) -> int:
|
||||
return self.num_prefill_nodes + self.num_decode_nodes
|
||||
@@ -383,6 +384,17 @@ class InferenceConfig(BaseConfig):
|
||||
WeightBroadcastConfig()
|
||||
)
|
||||
|
||||
kv_cache_offload: Annotated[
|
||||
KVCacheOffloadConfig | None,
|
||||
Field(
|
||||
description=(
|
||||
"CPU KV cache offload config for inference workers. Standard inference uses vLLM's "
|
||||
"OffloadingConnector. Disaggregated P/D deployments combine it with NIXL through "
|
||||
"MultiConnector in the SLURM launcher."
|
||||
),
|
||||
),
|
||||
] = None
|
||||
|
||||
enable_return_routed_experts: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
@@ -390,6 +402,13 @@ class InferenceConfig(BaseConfig):
|
||||
),
|
||||
] = False
|
||||
|
||||
enable_fp32_lm_head: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
description="Run the lm_head projection in fp32 via a native bf16xbf16 -> fp32 GEMM (`torch.mm` with `out_dtype=torch.float32`). Stabilizes logprob precision under FP8/bf16 inference, matching SGLang's `--enable-fp32-lm-head`. Implemented as a monkey-patch over vLLM's LogitsProcessor, activated by setting `additional_config[\"fp32_lm_head\"] = True` on the vLLM config.",
|
||||
),
|
||||
] = False
|
||||
|
||||
vllm_extra: Annotated[
|
||||
dict[str, Any],
|
||||
Field(
|
||||
@@ -428,6 +447,16 @@ class InferenceConfig(BaseConfig):
|
||||
raise ValueError("Must use SLURM for multi-node deployment.")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_kv_cache_offload(self):
|
||||
if self.kv_cache_offload is not None:
|
||||
if self.enable_prefix_caching is False:
|
||||
raise ValueError("KV cache offloading requires inference.enable_prefix_caching to be true.")
|
||||
if "enable_prefix_caching" not in self.model_fields_set:
|
||||
self.enable_prefix_caching = True
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_disaggregated(self):
|
||||
"""Auto-configure inference for disaggregated P/D: enable EP and compute DP."""
|
||||
@@ -499,6 +528,7 @@ class InferenceConfig(BaseConfig):
|
||||
to_vllm = {
|
||||
"server.host": "host",
|
||||
"server.port": "port",
|
||||
"server.liveness_timeout_seconds": "liveness_timeout_seconds",
|
||||
"model.name": "model",
|
||||
"model.dtype": "dtype",
|
||||
"model.max_model_len": "max_model_len",
|
||||
@@ -535,6 +565,26 @@ class InferenceConfig(BaseConfig):
|
||||
# Set `logprobs_mode` to `processed_logprobs` by default
|
||||
rsetattr(namespace, "logprobs_mode", "processed_logprobs")
|
||||
|
||||
if self.kv_cache_offload is not None:
|
||||
rsetattr(
|
||||
namespace,
|
||||
"kv_transfer_config",
|
||||
{
|
||||
"kv_connector": "OffloadingConnector",
|
||||
"kv_role": "kv_both",
|
||||
"kv_connector_extra_config": {
|
||||
"cpu_bytes_to_use": int(self.kv_cache_offload.cpu_bytes),
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
# Pass prime-rl-specific flags through vLLM's additional_config dict;
|
||||
# workers read these via get_current_vllm_config().additional_config.
|
||||
if self.enable_fp32_lm_head:
|
||||
existing = getattr(namespace, "additional_config", None) or {}
|
||||
existing["fp32_lm_head"] = True
|
||||
rsetattr(namespace, "additional_config", existing)
|
||||
|
||||
# Remove chat_template if not set (vLLM doesn't accept None)
|
||||
if namespace.chat_template is None:
|
||||
delattr(namespace, "chat_template")
|
||||
|
||||
@@ -681,6 +681,21 @@ class RLConfig(BaseConfig):
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_eplb_requires_quantized_weight_transfer(self):
|
||||
if self.inference is None or not self.inference.enable_eplb:
|
||||
return self
|
||||
|
||||
# TODO(matej): check if weight reloading works itself before supporting EPLB without quantized transfer.
|
||||
trainer_weight_broadcast = self.trainer.weight_broadcast
|
||||
if trainer_weight_broadcast.type != "nccl" or not trainer_weight_broadcast.quantize_in_weight_transfer:
|
||||
raise ValueError(
|
||||
"inference.enable_eplb requires weight_broadcast.type = 'nccl' and "
|
||||
"weight_broadcast.quantize_in_weight_transfer = true."
|
||||
)
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_bench(self):
|
||||
if self.bench:
|
||||
|
||||
@@ -299,6 +299,21 @@ class ModelConfig(BaseModelConfig):
|
||||
),
|
||||
] = 1
|
||||
|
||||
cp_style: Annotated[
|
||||
Literal["ring", "ulysses"],
|
||||
Field(
|
||||
description=(
|
||||
"Context parallelism communication style. "
|
||||
"'ring' uses ring-attention all-gather/reduce-scatter (current default, "
|
||||
"requires custom kernels per attention type). "
|
||||
"'ulysses' uses all-to-all to redistribute Q/K/V from sequence-sharded "
|
||||
"to head-sharded, runs vanilla attention locally on the full sequence, "
|
||||
"then all-to-all back. Works out-of-the-box with any attention kernel "
|
||||
"(softmax FA, linear attention, mamba, etc.)."
|
||||
),
|
||||
),
|
||||
] = "ring"
|
||||
|
||||
impl: Annotated[
|
||||
Literal["hf", "custom", "auto"],
|
||||
Field(
|
||||
@@ -394,9 +409,13 @@ class ModelConfig(BaseModelConfig):
|
||||
if self.cp > 1 and self.attn not in ["flash_attention_2", "flash_attention_3", "fa4"]:
|
||||
raise ValueError("CP is only supported with flash attention 2, flash attention 3, or fa4")
|
||||
if self.cp > 1 and self.attn in ("flash_attention_3", "fa4") and self.impl != "custom":
|
||||
# Both ring and ulysses route FA3/FA4 through our custom FlashAttention class:
|
||||
# ring patches `_compute_attention` with the ring kernel, ulysses patches it with
|
||||
# the all-to-all wrapper around the FA3/FA4 kernel. The HF path patches
|
||||
# `_flash_attention_forward` which only wraps FA2.
|
||||
raise ValueError(
|
||||
f"CP with {self.attn} requires model.impl='custom' "
|
||||
"(the ring-attention kernel is only implemented for the custom model path)"
|
||||
"(FA3/FA4 paths are only implemented for the custom model attention class)"
|
||||
)
|
||||
return self
|
||||
|
||||
|
||||
+7
-5
@@ -18,7 +18,7 @@ dependencies = [
|
||||
"torchaudio",
|
||||
"torchdata>=0.11.0",
|
||||
"transformers",
|
||||
"vllm>=0.20.1",
|
||||
"vllm>=0.20.2",
|
||||
"wandb>=0.26.1",
|
||||
"ring-flash-attn>=0.1.8",
|
||||
"prime>=0.5.73",
|
||||
@@ -171,6 +171,10 @@ transformers = { git = "https://github.com/huggingface/transformers.git", rev =
|
||||
flash-attn-4 = { git = "https://github.com/Dao-AILab/flash-attention.git", subdirectory = "flash_attn/cute", rev = "96bd151" }
|
||||
pydantic-config = { git = "https://github.com/samsja/pydantic_config.git", branch = "main" }
|
||||
vllm-router = { url = "https://github.com/PrimeIntellect-ai/router/releases/download/v0.1.22/vllm_router-0.1.22-cp38-abi3-manylinux_2_28_x86_64.whl" }
|
||||
vllm = [
|
||||
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_x86_64.whl", marker = "platform_machine == 'x86_64'" },
|
||||
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_aarch64.whl", marker = "platform_machine == 'aarch64'" },
|
||||
]
|
||||
reverse-text = { index = "primeintellect" }
|
||||
alphabet-sort = { index = "primeintellect" }
|
||||
wiki-search = { index = "primeintellect" }
|
||||
@@ -185,10 +189,8 @@ aime2024 = { index = "primeintellect" }
|
||||
aime2025 = { index = "primeintellect" }
|
||||
deepdive = { index = "primeintellect" }
|
||||
mini_swe_agent_plus = { index = "primeintellect" }
|
||||
deep-ep = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl" }
|
||||
# DeepGEMM bumped from 477618c to d30fc36 (newer kernel APIs needed by the
|
||||
# FP8 grouped-GEMM training path). Rebuild via scripts/install_deep_gemm.sh.
|
||||
deep-gemm = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.3.0+d30fc36-cp312-cp312-linux_x86_64.whl" }
|
||||
deep-ep = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl" }
|
||||
deep-gemm = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_x86_64.whl" }
|
||||
nixl-cu12 = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl" }
|
||||
flash-linear-attention = { git = "https://github.com/fla-org/flash-linear-attention" }
|
||||
flash_attn_3 = { index = "pytorch-cu128-test" }
|
||||
|
||||
@@ -15,9 +15,3 @@ export FLASH_ATTENTION_SKIP_CUDA_BUILD=FALSE
|
||||
echo "=== reinstalling flash-attn-cute (flash-attn overwrites it with a stub) ==="
|
||||
uv pip install --reinstall --no-deps \
|
||||
"flash-attn-4 @ git+https://github.com/Dao-AILab/flash-attention.git@96bd151#subdirectory=flash_attn/cute"
|
||||
|
||||
# TODO: remove once flash-attn gates the ampere_helpers import or cutlass-dsl re-adds it.
|
||||
echo "=== copying ampere_helpers.py from flashinfer vendor ==="
|
||||
SITE_PACKAGES=".venv/lib/python3.12/site-packages"
|
||||
cp "$SITE_PACKAGES/flashinfer/data/cutlass/python/CuTeDSL/cutlass/utils/ampere_helpers.py" \
|
||||
"$SITE_PACKAGES/nvidia_cutlass_dsl/python_packages/cutlass/utils/ampere_helpers.py"
|
||||
|
||||
@@ -45,6 +45,7 @@ def write_slurm_script(config: InferenceConfig, config_path: Path, script_path:
|
||||
num_nodes=getattr(config.deployment, "num_nodes", 1),
|
||||
port=config.server.port,
|
||||
disaggregated=is_disaggregated,
|
||||
kv_offload=config.kv_cache_offload is not None,
|
||||
)
|
||||
|
||||
is_multi_node = config.deployment.type == "multi_node"
|
||||
@@ -63,10 +64,7 @@ def write_slurm_script(config: InferenceConfig, config_path: Path, script_path:
|
||||
use_deep_gemm=config.use_deep_gemm,
|
||||
prefill_env_overrides=config.deployment.prefill_env_overrides,
|
||||
decode_env_overrides=config.deployment.decode_env_overrides,
|
||||
kv_offload=config.deployment.kv_cache_offload is not None,
|
||||
kv_offload_cpu_bytes=int(config.deployment.kv_cache_offload.cpu_bytes)
|
||||
if config.deployment.kv_cache_offload
|
||||
else 0,
|
||||
kv_offload_cpu_bytes=int(config.kv_cache_offload.cpu_bytes) if config.kv_cache_offload else 0,
|
||||
)
|
||||
elif is_multi_node:
|
||||
template_vars.update(
|
||||
|
||||
@@ -445,8 +445,10 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
|
||||
prefill_env_overrides=infer_deploy.prefill_env_overrides,
|
||||
decode_env_overrides=infer_deploy.decode_env_overrides,
|
||||
dp_per_node=config.deployment.gpus_per_node // config.inference.parallel.tp,
|
||||
kv_offload=infer_deploy.kv_cache_offload is not None,
|
||||
kv_offload_cpu_bytes=int(infer_deploy.kv_cache_offload.cpu_bytes) if infer_deploy.kv_cache_offload else 0,
|
||||
kv_offload=config.inference.kv_cache_offload is not None,
|
||||
kv_offload_cpu_bytes=int(config.inference.kv_cache_offload.cpu_bytes)
|
||||
if config.inference.kv_cache_offload
|
||||
else 0,
|
||||
use_nccl_broadcast=config.weight_broadcast is not None and config.weight_broadcast.type == "nccl",
|
||||
wandb_shared=config.wandb is not None and config.wandb.shared,
|
||||
ranks_filter=",".join(map(str, config.trainer.log.ranks_filter)),
|
||||
@@ -470,6 +472,7 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
|
||||
inference_enable_expert_parallel=config.inference.enable_expert_parallel if config.inference else False,
|
||||
inference_data_parallel_rpc_port=config.inference.data_parallel_rpc_port if config.inference else 29600,
|
||||
dp_per_node=(config.deployment.gpus_per_node // config.inference.parallel.tp) if config.inference else 1,
|
||||
kv_offload=config.inference is not None and config.inference.kv_cache_offload is not None,
|
||||
use_nccl_broadcast=config.weight_broadcast is not None and config.weight_broadcast.type == "nccl",
|
||||
wandb_shared=config.wandb is not None and config.wandb.shared,
|
||||
ranks_filter=",".join(map(str, config.trainer.log.ranks_filter)),
|
||||
|
||||
@@ -16,6 +16,7 @@ def transformers_v5_compat():
|
||||
_patch_qwen35_lora()
|
||||
_patch_lora_key_prefix()
|
||||
monkey_patch_deep_gemm_ep_scatter()
|
||||
monkey_patch_deep_gemm_silu_mul_quant_int64()
|
||||
monkey_patch_dp_engine_core_pause_resume_deadlock()
|
||||
|
||||
|
||||
@@ -173,6 +174,140 @@ def monkey_patch_deep_gemm_ep_scatter():
|
||||
logger.warning("Enabled int64-addressing Triton patch for vLLM DeepGEMM ep_scatter.")
|
||||
|
||||
|
||||
@triton.jit
|
||||
def _silu_mul_per_token_group_quant_fp8_colmajor_int64_kernel(
|
||||
y_ptr,
|
||||
y_q_ptr,
|
||||
y_s_ptr,
|
||||
M: tl.int64,
|
||||
N: tl.int64,
|
||||
y_s_col_stride: tl.int64,
|
||||
eps,
|
||||
fp8_min: tl.constexpr,
|
||||
fp8_max: tl.constexpr,
|
||||
use_ue8m0: tl.constexpr,
|
||||
GROUP_SIZE: tl.constexpr,
|
||||
BLOCK_M: tl.constexpr,
|
||||
BLOCK_N: tl.constexpr,
|
||||
):
|
||||
pid_m = tl.program_id(0)
|
||||
pid_n = tl.program_id(1)
|
||||
N_2 = N // 2
|
||||
|
||||
m_offset = (pid_m * BLOCK_M).to(tl.int64)
|
||||
n_offset = (pid_n * BLOCK_N).to(tl.int64)
|
||||
if m_offset >= M:
|
||||
return
|
||||
|
||||
offs_n = tl.arange(0, BLOCK_N).to(tl.int64)
|
||||
offs_m = tl.arange(0, BLOCK_M).to(tl.int64)
|
||||
|
||||
base_y_ptr = y_ptr + m_offset * N + n_offset
|
||||
act_in_ptrs = base_y_ptr + offs_m[:, None] * N + offs_n[None, :]
|
||||
|
||||
act_in = tl.load(act_in_ptrs)
|
||||
mul_in = tl.load(act_in_ptrs + N_2)
|
||||
|
||||
act_in = act_in.to(tl.float32)
|
||||
one_f32 = tl.cast(1, tl.float32)
|
||||
silu_out = (act_in / (one_f32 + tl.exp(-act_in))).to(y_ptr.dtype.element_ty)
|
||||
y = (silu_out * mul_in).to(tl.float32)
|
||||
|
||||
absmax = tl.maximum(tl.max(tl.abs(y), axis=1), eps)
|
||||
scale_raw = absmax * (1.0 / fp8_max)
|
||||
y_s = tl.math.exp2(tl.ceil(tl.log2(scale_raw))) if use_ue8m0 else scale_raw
|
||||
y_s = tl.reshape(y_s, (BLOCK_M, 1))
|
||||
y_q = tl.clamp(y / y_s, fp8_min, fp8_max).to(y_q_ptr.dtype.element_ty)
|
||||
|
||||
base_y_q_ptr = y_q_ptr + m_offset * N_2 + n_offset
|
||||
y_q_ptrs = base_y_q_ptr + offs_m[:, None] * N_2 + offs_n[None, :]
|
||||
tl.store(y_q_ptrs, y_q)
|
||||
|
||||
group_id = n_offset // GROUP_SIZE
|
||||
base_y_s_ptr = y_s_ptr + group_id * y_s_col_stride + m_offset
|
||||
y_s_ptrs = base_y_s_ptr + offs_m
|
||||
y_s = tl.reshape(y_s, (BLOCK_M,))
|
||||
tl.store(y_s_ptrs, y_s)
|
||||
|
||||
|
||||
def _silu_mul_per_token_group_quant_fp8_colmajor_int64(
|
||||
input: torch.Tensor,
|
||||
output: torch.Tensor | None = None,
|
||||
use_ue8m0: bool | None = None,
|
||||
eps: float = 1e-10,
|
||||
):
|
||||
from vllm.platforms import current_platform
|
||||
from vllm.utils.deep_gemm import is_deep_gemm_e8m0_used
|
||||
|
||||
group_size = 128
|
||||
assert input.ndim == 2
|
||||
if output is not None:
|
||||
assert output.ndim == 2
|
||||
assert input.size(0) % group_size == 0
|
||||
assert input.size(1) % (group_size * 2) == 0
|
||||
|
||||
if use_ue8m0 is None:
|
||||
use_ue8m0 = is_deep_gemm_e8m0_used()
|
||||
|
||||
M, N = input.size()
|
||||
N_2 = N // 2
|
||||
|
||||
fp8_dtype = current_platform.fp8_dtype()
|
||||
if output is None:
|
||||
output = torch.empty((M, N_2), dtype=fp8_dtype, device=input.device)
|
||||
|
||||
output_scales = torch.empty(((N_2 // group_size), M), dtype=torch.float32, device=input.device).transpose(0, 1)
|
||||
|
||||
block_m = 8
|
||||
block_n = group_size
|
||||
assert M % block_m == 0
|
||||
assert N_2 % block_n == 0
|
||||
|
||||
finfo = torch.finfo(fp8_dtype)
|
||||
fp8_min = -224.0 if current_platform.is_fp8_fnuz() else finfo.min
|
||||
fp8_max = 224.0 if current_platform.is_fp8_fnuz() else finfo.max
|
||||
|
||||
grid = (M // block_m, N_2 // block_n)
|
||||
_silu_mul_per_token_group_quant_fp8_colmajor_int64_kernel[grid](
|
||||
input,
|
||||
output,
|
||||
output_scales,
|
||||
M,
|
||||
N,
|
||||
output_scales.stride(-1),
|
||||
eps,
|
||||
fp8_min,
|
||||
fp8_max,
|
||||
use_ue8m0,
|
||||
group_size,
|
||||
block_m,
|
||||
block_n,
|
||||
)
|
||||
|
||||
return output, output_scales
|
||||
|
||||
|
||||
def monkey_patch_deep_gemm_silu_mul_quant_int64():
|
||||
# Temporary local carry for large DeepGEMM profile shapes whose row offsets
|
||||
# exceed signed int32 address arithmetic in vLLM's Triton kernel.
|
||||
import sys
|
||||
|
||||
from vllm.logger import init_logger
|
||||
from vllm.model_executor.layers.quantization.utils import fp8_utils
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
fp8_utils.silu_mul_per_token_group_quant_fp8_colmajor = _silu_mul_per_token_group_quant_fp8_colmajor_int64
|
||||
|
||||
deep_gemm_moe_module = sys.modules.get("vllm.model_executor.layers.fused_moe.experts.deep_gemm_moe")
|
||||
if deep_gemm_moe_module is not None:
|
||||
deep_gemm_moe_module.silu_mul_per_token_group_quant_fp8_colmajor = (
|
||||
_silu_mul_per_token_group_quant_fp8_colmajor_int64
|
||||
)
|
||||
|
||||
logger.warning("Enabled int64-addressing Triton patch for vLLM DeepGEMM SiLU/mul FP8 quant.")
|
||||
|
||||
|
||||
def _patch_qwen35_lora():
|
||||
"""Fix Qwen3.5 LoRA: align packed_modules_mapping with output_sizes.
|
||||
|
||||
@@ -812,3 +947,65 @@ def monkey_patch_no_moe_lora():
|
||||
self.is_lora_enabled = False
|
||||
|
||||
FusedMoEConfig.__post_init__ = _patched__post_init__
|
||||
|
||||
|
||||
def monkey_patch_fp32_lm_head():
|
||||
"""Run the lm_head projection in fp32, via a native bf16xbf16 -> fp32 GEMM.
|
||||
|
||||
Uses ``torch.mm(..., out_dtype=torch.float32)`` (PyTorch >= 2.10) so the
|
||||
matmul accumulates and emits fp32 directly without zero-padding the bf16
|
||||
operands or maintaining a separate fp32 weight copy. This avoids the
|
||||
epilogue truncation to bf16 that `F.linear(bf16, bf16)` does, which is
|
||||
where lm_head precision actually leaks before the sampler's softmax.
|
||||
|
||||
Activated by setting ``additional_config["fp32_lm_head"] = True`` on the
|
||||
vLLM namespace; the launcher does this when ``inference.enable_fp32_lm_head``
|
||||
is set. The flag is captured once on ``LogitsProcessor.__init__`` (where
|
||||
vLLM guarantees a ``set_current_vllm_config()`` context) and stored on the
|
||||
instance — reading it from ``_get_logits`` during serving doesn't work
|
||||
because vLLM doesn't keep the context set during forwards.
|
||||
|
||||
Tracks vllm-project/vllm#24567 (which uses the operand-upcast approach).
|
||||
Per @Jackmin801 on PR #2438, native ``out_dtype=fp32`` mm is more efficient
|
||||
and just as correct.
|
||||
"""
|
||||
import torch
|
||||
from vllm.config import get_current_vllm_config
|
||||
from vllm.logger import init_logger
|
||||
from vllm.model_executor.layers.logits_processor import LogitsProcessor
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
_original_init = LogitsProcessor.__init__
|
||||
_original_get_logits = LogitsProcessor._get_logits
|
||||
|
||||
def _patched_init(self, *args, **kwargs):
|
||||
_original_init(self, *args, **kwargs)
|
||||
vllm_config = get_current_vllm_config()
|
||||
additional_config = vllm_config.additional_config or {}
|
||||
self._fp32_lm_head_enabled = additional_config.get("fp32_lm_head", False)
|
||||
if self._fp32_lm_head_enabled:
|
||||
logger.warning("fp32 lm_head ENABLED for this LogitsProcessor instance.")
|
||||
|
||||
def _patched_get_logits(self, hidden_states, lm_head, embedding_bias):
|
||||
if not getattr(self, "_fp32_lm_head_enabled", False):
|
||||
return _original_get_logits(self, hidden_states, lm_head, embedding_bias)
|
||||
|
||||
# Native bf16xbf16 -> fp32 GEMM. torch.mm requires 2D inputs; vLLM v1's
|
||||
# generative path passes 2D [num_tokens, hidden_size] hidden_states, but
|
||||
# flatten defensively in case some future caller passes 3D.
|
||||
flat = hidden_states.reshape(-1, hidden_states.shape[-1])
|
||||
logits = torch.mm(flat, lm_head.weight.t(), out_dtype=torch.float32)
|
||||
if embedding_bias is not None:
|
||||
logits = logits + embedding_bias.to(torch.float32)
|
||||
if hidden_states.dim() > 2:
|
||||
logits = logits.reshape(*hidden_states.shape[:-1], -1)
|
||||
|
||||
logits = self._gather_logits(logits)
|
||||
if logits is not None:
|
||||
logits = logits[..., : self.org_vocab_size]
|
||||
return logits
|
||||
|
||||
LogitsProcessor.__init__ = _patched_init
|
||||
LogitsProcessor._get_logits = _patched_get_logits
|
||||
logger.info("Installed fp32 lm_head patch (native out_dtype=fp32 mm).")
|
||||
|
||||
@@ -160,7 +160,6 @@ logger = init_logger("vllm.entrypoints.openai.api_server")
|
||||
|
||||
# Create our own router for custom endpoints
|
||||
router = APIRouter()
|
||||
LIVENESS_TIMEOUT_SECONDS = 5.0
|
||||
|
||||
|
||||
def engine_client(request: Request) -> EngineClient:
|
||||
@@ -272,7 +271,7 @@ async def liveness(raw_request: Request):
|
||||
try:
|
||||
await asyncio.wait_for(
|
||||
engine_client(raw_request).collective_rpc("liveness_probe"),
|
||||
timeout=LIVENESS_TIMEOUT_SECONDS,
|
||||
timeout=raw_request.app.state.liveness_timeout_seconds,
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
return JSONResponse({"status": "engine_unresponsive"}, status_code=503)
|
||||
@@ -312,6 +311,7 @@ async def custom_init_app_state(
|
||||
await init_app_state(engine_client, state, args, supported_tasks)
|
||||
|
||||
state.reset_prefix_cache_after_update = getattr(args, "reset_prefix_cache_after_update", True)
|
||||
state.liveness_timeout_seconds = args.liveness_timeout_seconds
|
||||
|
||||
# TITO: server-side chat templating + token IDs.
|
||||
if "generate" in supported_tasks and state.openai_serving_chat is not None:
|
||||
|
||||
@@ -2,6 +2,7 @@ import logging
|
||||
import os
|
||||
|
||||
from prime_rl.inference.patches import (
|
||||
monkey_patch_fp32_lm_head,
|
||||
monkey_patch_LRUCacheWorkerLoRAManager,
|
||||
monkey_patch_minimax_m2_for_lora,
|
||||
monkey_patch_no_moe_lora,
|
||||
@@ -23,3 +24,6 @@ if os.environ.get("PRIME_NO_MOE_LORA") == "1":
|
||||
monkey_patch_no_moe_lora()
|
||||
else:
|
||||
logger.info("PRIME_NO_MOE_LORA=0: no patch applied")
|
||||
|
||||
# Install fp32 lm_head patch; self-gates on additional_config["fp32_lm_head"] at call time
|
||||
monkey_patch_fp32_lm_head()
|
||||
|
||||
@@ -2,7 +2,8 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from torch.nn import Module
|
||||
from vllm.model_executor.model_loader import DefaultModelLoader, get_model_loader
|
||||
from vllm.model_executor.model_loader.utils import process_weights_after_loading
|
||||
|
||||
from prime_rl.inference.vllm.worker.weight_transfer import load_weights_checkpoint_layerwise
|
||||
|
||||
# This is to get type hints for the Worker class but not actually extend it at runtime as this is required by vLLM worker extension
|
||||
if TYPE_CHECKING:
|
||||
@@ -46,8 +47,9 @@ class FileSystemWeightUpdateWorker(Worker):
|
||||
allow_patterns_overrides=getattr(model, "allow_patterns_overrides", None),
|
||||
)
|
||||
weights_iterator = model_loader._get_weights_iterator(local_source)
|
||||
model.load_weights(weights_iterator) # type: ignore
|
||||
|
||||
# Process weights after loading (important for some models)
|
||||
device = next(model.parameters()).device
|
||||
process_weights_after_loading(model, self.model_runner.model_config, device)
|
||||
load_weights_checkpoint_layerwise(
|
||||
model,
|
||||
weights_iterator,
|
||||
self.model_runner.model_config,
|
||||
self.vllm_config,
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pickle
|
||||
from typing import TYPE_CHECKING, Callable, Generator, cast
|
||||
from typing import TYPE_CHECKING, Generator, cast
|
||||
|
||||
import torch
|
||||
from torch.nn import Module
|
||||
@@ -8,10 +8,9 @@ from vllm.distributed.utils import StatelessProcessGroup
|
||||
from vllm.logger import init_logger
|
||||
|
||||
from prime_rl.inference.vllm.worker.weight_transfer import (
|
||||
load_weights_checkpoint,
|
||||
load_weights_checkpoint_layerwise,
|
||||
load_weights_kernel,
|
||||
postprocess_weights_checkpoint,
|
||||
postprocess_weights_kernel,
|
||||
update_mla_absorbed_weights,
|
||||
)
|
||||
from prime_rl.utils.nccl import disable_nccl_p2p_if_unavailable
|
||||
|
||||
@@ -144,15 +143,14 @@ class NCCLWeightUpdateWorker(Worker):
|
||||
assert isinstance(model, Module)
|
||||
|
||||
state_iter = self.nccl_broadcast_receiver.receive_state_dict()
|
||||
device = next(model.parameters()).device
|
||||
loader_fn: Callable[[Module, Generator[tuple[str, torch.Tensor], None, None]], None]
|
||||
postprocess_fn: Callable[[Module, object, torch.device], None]
|
||||
if self.quantize_in_weight_transfer:
|
||||
loader_fn = load_weights_kernel
|
||||
postprocess_fn = postprocess_weights_kernel
|
||||
else:
|
||||
loader_fn = load_weights_checkpoint
|
||||
postprocess_fn = postprocess_weights_checkpoint
|
||||
load_weights_kernel(model, state_iter)
|
||||
update_mla_absorbed_weights(model)
|
||||
return
|
||||
|
||||
loader_fn(model, state_iter)
|
||||
postprocess_fn(model, self.model_runner.model_config, device)
|
||||
load_weights_checkpoint_layerwise(
|
||||
model,
|
||||
state_iter,
|
||||
self.model_runner.model_config,
|
||||
self.vllm_config,
|
||||
)
|
||||
|
||||
@@ -1,44 +1,94 @@
|
||||
from typing import Generator
|
||||
from typing import Generator, Iterable
|
||||
|
||||
import torch
|
||||
from torch.nn import Module
|
||||
from vllm.config import set_current_vllm_config
|
||||
from vllm.logger import init_logger
|
||||
from vllm.model_executor.model_loader.utils import process_weights_after_loading
|
||||
from vllm.model_executor.model_loader.reload import finalize_layerwise_reload, initialize_layerwise_reload
|
||||
|
||||
logger = init_logger("vllm.inference.vllm.worker_weight_transfer")
|
||||
|
||||
|
||||
def load_weights_checkpoint(model: Module, state_iter: Generator[tuple[str, torch.Tensor], None, None]) -> None:
|
||||
model.load_weights(state_iter) # type: ignore
|
||||
def load_weights_checkpoint_layerwise(
|
||||
model: Module,
|
||||
state_iter: Iterable[tuple[str, torch.Tensor]],
|
||||
model_config,
|
||||
vllm_config,
|
||||
) -> None:
|
||||
logger.info("Reloading checkpoint-format weights with vLLM layerwise processing")
|
||||
device = next(model.parameters()).device
|
||||
with torch.device(device), set_current_vllm_config(vllm_config):
|
||||
initialize_layerwise_reload(model)
|
||||
model.load_weights(state_iter) # type: ignore
|
||||
finalize_layerwise_reload(model, model_config)
|
||||
|
||||
|
||||
def postprocess_weights_checkpoint(model: Module, model_config, device: torch.device) -> None:
|
||||
process_weights_after_loading(model, model_config, device)
|
||||
def _invert_logical_to_physical_map(logical_to_physical_map: torch.Tensor, num_physical_experts: int) -> torch.Tensor:
|
||||
"""Build a physical expert -> logical expert map from vLLM EPLB state."""
|
||||
physical_to_logical = torch.full(
|
||||
(num_physical_experts,),
|
||||
-1,
|
||||
dtype=torch.long,
|
||||
device=logical_to_physical_map.device,
|
||||
)
|
||||
logical_indices = torch.arange(
|
||||
logical_to_physical_map.shape[0],
|
||||
dtype=torch.long,
|
||||
device=logical_to_physical_map.device,
|
||||
)[:, None].expand_as(logical_to_physical_map)
|
||||
physical_indices = logical_to_physical_map.to(torch.long)
|
||||
invalid = (physical_indices < -1) | (physical_indices >= num_physical_experts)
|
||||
if invalid.any():
|
||||
invalid_indices = physical_indices[invalid].unique().tolist()
|
||||
raise ValueError(f"EPLB maps to invalid physical experts: {invalid_indices}")
|
||||
|
||||
valid = physical_indices >= 0
|
||||
physical_to_logical[physical_indices[valid]] = logical_indices[valid]
|
||||
return physical_to_logical
|
||||
|
||||
|
||||
def _build_expert_source_indices(module) -> torch.Tensor | None:
|
||||
if module._expert_map is None:
|
||||
return None
|
||||
|
||||
physical_indices = torch.where(module._expert_map >= 0)[0]
|
||||
local_indices = module._expert_map[physical_indices]
|
||||
physical_indices = physical_indices[local_indices.argsort()]
|
||||
|
||||
eplb_layer_state = getattr(module, "eplb_state", None)
|
||||
logical_to_physical_map = getattr(eplb_layer_state, "logical_to_physical_map", None)
|
||||
if logical_to_physical_map is None:
|
||||
return physical_indices
|
||||
|
||||
physical_to_logical = _invert_logical_to_physical_map(logical_to_physical_map, module.global_num_experts)
|
||||
logical_indices = physical_to_logical[physical_indices.to(physical_to_logical.device)]
|
||||
if (logical_indices < 0).any():
|
||||
missing = physical_indices[(logical_indices < 0).to(physical_indices.device)].tolist()
|
||||
raise ValueError(f"EPLB has no logical mapping for local physical experts: {missing}")
|
||||
|
||||
return logical_indices.to(physical_indices.device)
|
||||
|
||||
|
||||
def build_expert_map(model: Module) -> dict[str, torch.Tensor]:
|
||||
"""Map FusedMoE module names to global expert indices local to this worker."""
|
||||
"""Map FusedMoE module names to source expert indices local to this worker."""
|
||||
from vllm.model_executor.layers.fused_moe.layer import FusedMoE
|
||||
|
||||
expert_slices: dict[str, torch.Tensor] = {}
|
||||
source_indices_by_module: dict[str, torch.Tensor] = {}
|
||||
for module_name, module in model.named_modules():
|
||||
if not isinstance(module, FusedMoE):
|
||||
continue
|
||||
if module._expert_map is None:
|
||||
source_indices = _build_expert_source_indices(module)
|
||||
if source_indices is None:
|
||||
continue
|
||||
|
||||
global_indices = torch.where(module._expert_map >= 0)[0]
|
||||
local_indices = module._expert_map[global_indices]
|
||||
global_indices = global_indices[local_indices.argsort()]
|
||||
expert_slices[module_name] = global_indices
|
||||
return expert_slices
|
||||
source_indices_by_module[module_name] = source_indices
|
||||
return source_indices_by_module
|
||||
|
||||
|
||||
@torch.no_grad()
|
||||
def load_weights_kernel(model: Module, state_iter: Generator[tuple[str, torch.Tensor], None, None]) -> None:
|
||||
"""Load vLLM kernel-format tensors using in-place copy_ updates."""
|
||||
params = dict(model.named_parameters())
|
||||
expert_slices = build_expert_map(model)
|
||||
expert_source_indices = build_expert_map(model)
|
||||
|
||||
loaded = 0
|
||||
skipped: list[str] = []
|
||||
@@ -51,15 +101,13 @@ def load_weights_kernel(model: Module, state_iter: Generator[tuple[str, torch.Te
|
||||
|
||||
param = params[name]
|
||||
if param.shape != tensor.shape:
|
||||
sliced = False
|
||||
for module_name, global_indices in expert_slices.items():
|
||||
for module_name, source_indices in expert_source_indices.items():
|
||||
if not name.startswith(f"{module_name}."):
|
||||
continue
|
||||
tensor = tensor[global_indices.to(tensor.device)]
|
||||
sliced = True
|
||||
tensor = tensor[source_indices.to(tensor.device)]
|
||||
break
|
||||
|
||||
if not sliced or param.shape != tensor.shape:
|
||||
if param.shape != tensor.shape:
|
||||
shape_mismatches.append(f"{name}: param={list(param.shape)} != received={list(tensor.shape)}")
|
||||
continue
|
||||
|
||||
@@ -102,7 +150,3 @@ def update_mla_absorbed_weights(model: Module) -> None:
|
||||
module.W_UK_T.copy_(w_uk.permute(1, 2, 0))
|
||||
|
||||
logger.debug(f"Updated MLA absorbed weights for module {name}")
|
||||
|
||||
|
||||
def postprocess_weights_kernel(model: Module, _model_config, _device: torch.device) -> None:
|
||||
update_mla_absorbed_weights(model)
|
||||
|
||||
@@ -142,6 +142,10 @@ srun bash -c '
|
||||
INFER_NODE_RANK=$SLURM_PROCID
|
||||
LOCAL_IP=$(hostname -I | awk "{print \$1}")
|
||||
|
||||
{%- if kv_offload %}
|
||||
ulimit -l unlimited
|
||||
{%- endif %}
|
||||
|
||||
{% if disaggregated -%}
|
||||
# NVSHMEM libs for DeepEP — ensure the rpath target exists on all nodes
|
||||
if [ ! -d /tmp/deepep_build/nvshmem/lib ] && [ -d "$OUTPUT_DIR/nvshmem/lib" ]; then
|
||||
@@ -167,7 +171,6 @@ srun bash -c '
|
||||
export VLLM_NIXL_SIDE_CHANNEL_PORT=5600
|
||||
|
||||
{%- if kv_offload %}
|
||||
ulimit -l unlimited
|
||||
PREFILL_KV_CFG='"'"'{"kv_connector":"MultiConnector","kv_role":"kv_both","kv_connector_extra_config":{"connectors":[{"kv_connector":"NixlConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_threads":1}},{"kv_connector":"OffloadingConnector","kv_role":"kv_both","kv_connector_extra_config":{"cpu_bytes_to_use":{{ kv_offload_cpu_bytes }}}}]}}'"'"'
|
||||
{%- else %}
|
||||
PREFILL_KV_CFG='"'"'{"kv_connector":"NixlConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_threads":1}}'"'"'
|
||||
|
||||
@@ -197,6 +197,10 @@ if [ "$SLURM_PROCID" -lt "$NUM_INFER_NODES" ]; then
|
||||
export VLLM_WORKER_MULTIPROC_METHOD=spawn
|
||||
LOCAL_IP=$(hostname -I | awk "{print \$1}")
|
||||
|
||||
{%- if kv_offload %}
|
||||
ulimit -l unlimited
|
||||
{%- endif %}
|
||||
|
||||
REPLICA_IDX=$((INFER_NODE_RANK / NODES_PER_INFER_REPLICA))
|
||||
RANK_IN_REPLICA=$((INFER_NODE_RANK % NODES_PER_INFER_REPLICA))
|
||||
|
||||
@@ -219,7 +223,6 @@ if [ "$SLURM_PROCID" -lt "$NUM_INFER_NODES" ]; then
|
||||
export VLLM_NIXL_SIDE_CHANNEL_PORT=5600
|
||||
|
||||
{%- if kv_offload %}
|
||||
ulimit -l unlimited
|
||||
PREFILL_KV_CFG='"'"'{"kv_connector":"MultiConnector","kv_role":"kv_both","kv_connector_extra_config":{"connectors":[{"kv_connector":"NixlConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_threads":1}},{"kv_connector":"OffloadingConnector","kv_role":"kv_both","kv_connector_extra_config":{"cpu_bytes_to_use":{{ kv_offload_cpu_bytes }}}}]}}'"'"'
|
||||
{%- else %}
|
||||
PREFILL_KV_CFG='"'"'{"kv_connector":"NixlConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_threads":1}}'"'"'
|
||||
@@ -335,9 +338,9 @@ if [ "$SLURM_PROCID" -lt "$NUM_INFER_NODES" ]; then
|
||||
INFER_DP_START_RANK=$((RANK_IN_REPLICA * INFERENCE_DP_LOCAL))
|
||||
|
||||
if [ "$RANK_IN_REPLICA" -eq 0 ]; then
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$LOCAL_IP\"}"
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$LOCAL_IP\", \"data_parallel_hybrid_lb\": true}"
|
||||
else
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$REPLICA_HEAD_HOST\", \"data_parallel_start_rank\": $INFER_DP_START_RANK}"
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$REPLICA_HEAD_HOST\", \"data_parallel_start_rank\": $INFER_DP_START_RANK, \"data_parallel_hybrid_lb\": true}"
|
||||
fi
|
||||
|
||||
uv run inference \
|
||||
|
||||
@@ -188,11 +188,18 @@ def convert_tt_layer_to_vllm_kernel(
|
||||
if key in state_dict:
|
||||
add_maybe_fp8(key, state_dict[key])
|
||||
|
||||
for suffix in ["indexer.wq_b.weight", "indexer.wk.weight"]:
|
||||
key = f"{prefix}.self_attn.{suffix}"
|
||||
if key in state_dict:
|
||||
add_maybe_fp8(key, state_dict[key])
|
||||
for suffix in ["indexer.k_norm.weight", "indexer.k_norm.bias", "indexer.weights_proj.weight"]:
|
||||
indexer_wq_b_key = f"{prefix}.self_attn.indexer.wq_b.weight"
|
||||
if indexer_wq_b_key in state_dict:
|
||||
add_maybe_fp8(indexer_wq_b_key, state_dict[indexer_wq_b_key])
|
||||
|
||||
indexer_wk_key = f"{prefix}.self_attn.indexer.wk.weight"
|
||||
indexer_weights_proj_key = f"{prefix}.self_attn.indexer.weights_proj.weight"
|
||||
if indexer_wk_key in state_dict and indexer_weights_proj_key in state_dict:
|
||||
add(
|
||||
f"{prefix}.self_attn.indexer.wk_weights_proj.weight",
|
||||
torch.cat([state_dict[indexer_wk_key], state_dict[indexer_weights_proj_key]], dim=0),
|
||||
)
|
||||
for suffix in ["indexer.k_norm.weight", "indexer.k_norm.bias"]:
|
||||
key = f"{prefix}.self_attn.{suffix}"
|
||||
if key in state_dict:
|
||||
add(key, state_dict[key])
|
||||
|
||||
@@ -307,6 +307,10 @@ class GptOssForCausalLM(GptOssPreTrainedModel, GenerationMixin):
|
||||
temperature: torch.Tensor | None = None,
|
||||
**kwargs: Unpack[TransformersKwargs],
|
||||
) -> PrimeLmOutput:
|
||||
r"""
|
||||
temperature (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
||||
Per-token temperatures for logprobs/entropy computation when `labels` are provided.
|
||||
"""
|
||||
assert use_cache is None or not use_cache, "use_cache is not supported for custom GPT-OSS"
|
||||
assert past_key_values is None, "past_key_values is not supported for custom GPT-OSS"
|
||||
|
||||
|
||||
@@ -139,17 +139,18 @@ def _unpack_grouped_rows_kernel(
|
||||
actual_m = tl.load(actual_ms_ptr + pid_g)
|
||||
row_offsets = (pid_blk - block_start) * GROUP_BLOCK_M + pid_sub * BLOCK_M + tl.arange(0, BLOCK_M)
|
||||
col_offsets = pid_n * BLOCK_N + tl.arange(0, BLOCK_N)
|
||||
src_rows_i64 = (pid_blk * GROUP_BLOCK_M + pid_sub * BLOCK_M + tl.arange(0, BLOCK_M)).to(tl.int64)
|
||||
dst_rows_i64 = (dst_start + row_offsets).to(tl.int64)
|
||||
col_offsets_i64 = col_offsets.to(tl.int64)
|
||||
valid_rows = row_offsets < actual_m
|
||||
valid_cols = col_offsets < cols
|
||||
x = tl.load(
|
||||
x_ptr
|
||||
+ (pid_blk * GROUP_BLOCK_M + pid_sub * BLOCK_M + tl.arange(0, BLOCK_M))[:, None] * stride_xm
|
||||
+ col_offsets[None, :] * stride_xn,
|
||||
x_ptr + src_rows_i64[:, None] * stride_xm + col_offsets_i64[None, :] * stride_xn,
|
||||
mask=valid_rows[:, None] & valid_cols[None, :],
|
||||
other=0.0,
|
||||
)
|
||||
tl.store(
|
||||
out_ptr + (dst_start + row_offsets)[:, None] * stride_ym + col_offsets[None, :] * stride_yn,
|
||||
out_ptr + dst_rows_i64[:, None] * stride_ym + col_offsets_i64[None, :] * stride_yn,
|
||||
x,
|
||||
mask=valid_rows[:, None] & valid_cols[None, :],
|
||||
)
|
||||
@@ -176,9 +177,11 @@ def _per_token_fp8_kernel(
|
||||
pid_k = tl.program_id(axis=1)
|
||||
row_offsets = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)
|
||||
col_offsets = pid_k * BLOCK_K + tl.arange(0, BLOCK_K)
|
||||
row_offsets_i64 = row_offsets.to(tl.int64)
|
||||
col_offsets_i64 = col_offsets.to(tl.int64)
|
||||
mask = (row_offsets[:, None] < rows) & (col_offsets[None, :] < cols)
|
||||
x = tl.load(
|
||||
x_ptr + row_offsets[:, None] * stride_xm + col_offsets[None, :] * stride_xn,
|
||||
x_ptr + row_offsets_i64[:, None] * stride_xm + col_offsets_i64[None, :] * stride_xn,
|
||||
mask=mask,
|
||||
other=0.0,
|
||||
).to(tl.float32)
|
||||
@@ -188,11 +191,11 @@ def _per_token_fp8_kernel(
|
||||
scale = tl.exp2(tl.ceil(tl.log2(scale)))
|
||||
y = x / scale[:, None]
|
||||
tl.store(
|
||||
out_ptr + row_offsets[:, None] * stride_ym + col_offsets[None, :] * stride_yn,
|
||||
out_ptr + row_offsets_i64[:, None] * stride_ym + col_offsets_i64[None, :] * stride_yn,
|
||||
y.to(tl.float8e4nv),
|
||||
mask=mask,
|
||||
)
|
||||
tl.store(sf_ptr + row_offsets * stride_sm + pid_k * stride_sk, scale, mask=row_offsets < rows)
|
||||
tl.store(sf_ptr + row_offsets_i64 * stride_sm + pid_k * stride_sk, scale, mask=row_offsets < rows)
|
||||
|
||||
|
||||
@triton.jit
|
||||
@@ -226,12 +229,13 @@ def _grouped_per_token_fp8_kernel(
|
||||
local_block = pid_blk - block_start
|
||||
row_offsets = local_block * GROUP_BLOCK_M + pid_sub * BLOCK_M + tl.arange(0, BLOCK_M)
|
||||
col_offsets = pid_k * BLOCK_K + tl.arange(0, BLOCK_K)
|
||||
src_rows_i64 = (src_start + row_offsets).to(tl.int64)
|
||||
dst_rows_i64 = (pid_blk * GROUP_BLOCK_M + pid_sub * BLOCK_M + tl.arange(0, BLOCK_M)).to(tl.int64)
|
||||
col_offsets_i64 = col_offsets.to(tl.int64)
|
||||
valid_rows = row_offsets < actual_m
|
||||
valid_cols = col_offsets < cols
|
||||
src_rows = src_start + row_offsets
|
||||
dst_rows = pid_blk * GROUP_BLOCK_M + pid_sub * BLOCK_M + tl.arange(0, BLOCK_M)
|
||||
x = tl.load(
|
||||
x_ptr + src_rows[:, None] * stride_xm + col_offsets[None, :] * stride_xn,
|
||||
x_ptr + src_rows_i64[:, None] * stride_xm + col_offsets_i64[None, :] * stride_xn,
|
||||
mask=valid_rows[:, None] & valid_cols[None, :],
|
||||
other=0.0,
|
||||
).to(tl.float32)
|
||||
@@ -241,11 +245,11 @@ def _grouped_per_token_fp8_kernel(
|
||||
scale = tl.exp2(tl.ceil(tl.log2(scale)))
|
||||
y = x / scale[:, None]
|
||||
tl.store(
|
||||
out_ptr + dst_rows[:, None] * stride_ym + col_offsets[None, :] * stride_yn,
|
||||
out_ptr + dst_rows_i64[:, None] * stride_ym + col_offsets_i64[None, :] * stride_yn,
|
||||
y.to(tl.float8e4nv),
|
||||
mask=valid_rows[:, None] & valid_cols[None, :],
|
||||
)
|
||||
tl.store(sf_ptr + dst_rows * stride_sm + pid_k * stride_sk, scale, mask=valid_rows)
|
||||
tl.store(sf_ptr + dst_rows_i64 * stride_sm + pid_k * stride_sk, scale, mask=valid_rows)
|
||||
|
||||
|
||||
@triton.jit
|
||||
@@ -277,11 +281,13 @@ def _grouped_per_channel_fp8_sm90_kmajor_kernel(
|
||||
local_block = pid_blk - block_start
|
||||
row_offsets = local_block * BLOCK_K + tl.arange(0, BLOCK_K)
|
||||
col_offsets = pid_n * BLOCK_N + tl.arange(0, BLOCK_N)
|
||||
src_rows_i64 = (src_start + row_offsets).to(tl.int64)
|
||||
row_offsets_i64 = row_offsets.to(tl.int64)
|
||||
col_offsets_i64 = col_offsets.to(tl.int64)
|
||||
valid_rows = row_offsets < actual_m
|
||||
valid_cols = col_offsets < cols
|
||||
src_rows = src_start + row_offsets
|
||||
x = tl.load(
|
||||
x_ptr + src_rows[:, None] * stride_xm + col_offsets[None, :] * stride_xn,
|
||||
x_ptr + src_rows_i64[:, None] * stride_xm + col_offsets_i64[None, :] * stride_xn,
|
||||
mask=valid_rows[:, None] & valid_cols[None, :],
|
||||
other=0.0,
|
||||
).to(tl.float32)
|
||||
@@ -290,11 +296,11 @@ def _grouped_per_channel_fp8_sm90_kmajor_kernel(
|
||||
if USE_UE8M0:
|
||||
scale = tl.exp2(tl.ceil(tl.log2(scale)))
|
||||
y = x / scale[None, :]
|
||||
flat_base = block_start * BLOCK_K * cols
|
||||
out_ptrs = out_ptr + flat_base + col_offsets[:, None] * aligned_m + row_offsets[None, :]
|
||||
flat_base = block_start.to(tl.int64) * BLOCK_K * cols
|
||||
out_ptrs = out_ptr + flat_base + col_offsets_i64[:, None] * aligned_m + row_offsets_i64[None, :]
|
||||
tl.store(out_ptrs, tl.trans(y).to(tl.float8e4nv), mask=valid_cols[:, None] & (row_offsets[None, :] < aligned_m))
|
||||
tl.store(
|
||||
sf_ptr + pid_blk * stride_sf0 + col_offsets * stride_sf1,
|
||||
sf_ptr + pid_blk * stride_sf0 + col_offsets_i64 * stride_sf1,
|
||||
scale,
|
||||
mask=valid_cols,
|
||||
)
|
||||
|
||||
@@ -113,7 +113,12 @@ class Float8BlockwiseLinear(nn.Linear):
|
||||
DEFAULT_FP8_IGNORE_PATTERNS: list[str] = [
|
||||
"lm_head",
|
||||
"router",
|
||||
"mlp.gate.",
|
||||
# Use escaped dots — re.search treats `.` as any-char, so the previous
|
||||
# "mlp.gate." pattern was also matching dense MLP `mlp.gate_proj` (the
|
||||
# trailing `.` was matching `_`). That left the dense MLP gate projection
|
||||
# in BF16 on the trainer while inference quantized it to FP8, causing
|
||||
# hidden-state drift before the MoE router.
|
||||
r"mlp\.gate\.",
|
||||
"shared_expert_gate", # Qwen3.5 MoE: nn.Linear(hidden, 1, bias=False)
|
||||
"eh_proj",
|
||||
"weights_proj",
|
||||
|
||||
@@ -0,0 +1,296 @@
|
||||
"""Ulysses-style context parallelism via all-to-all on the head/seq dimensions.
|
||||
|
||||
Ulysses is the simpler alternative to ring attention for context parallelism:
|
||||
|
||||
sequence-sharded Q/K/V head-sharded Q/K/V
|
||||
[S/cp, H, D] ── all-to-all ──▶ [S, H/cp, D]
|
||||
(heads ↔ seq)
|
||||
│
|
||||
▼
|
||||
run vanilla local attention
|
||||
on the *full* sequence with
|
||||
*fewer* heads (any kernel works)
|
||||
│
|
||||
▼
|
||||
[S/cp, H, D] ◀── all-to-all ── [S, H/cp, D]
|
||||
(seq ↔ heads)
|
||||
|
||||
Key benefit: the attention kernel itself does not need to be CP-aware. The
|
||||
all-to-all is purely on Q/K/V tensors, so this works out of the box with
|
||||
softmax flash-attn, linear attention, mamba, etc., without rewriting kernels.
|
||||
|
||||
Constraints:
|
||||
- cp_size must divide both num_attention_heads and num_key_value_heads.
|
||||
- Sequence length must be divisible by cp_size.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import torch
|
||||
import torch.distributed as dist
|
||||
import torch.distributed.nn.functional as dist_nn
|
||||
|
||||
# Populated by `update_ulysses_params` before each forward pass. Mirrors
|
||||
# ring_flash_attn's DATA_PARAMS pattern so the patched attention path can
|
||||
# reach the *full* (un-sharded) cu_seqlens / max_seqlen at call time.
|
||||
ULYSSES_PARAMS: dict = {}
|
||||
|
||||
|
||||
def update_ulysses_params(cu_seqlens: torch.Tensor, max_seqlen: int) -> None:
|
||||
ULYSSES_PARAMS["cu_seqlens"] = cu_seqlens
|
||||
ULYSSES_PARAMS["max_seqlen"] = int(max_seqlen)
|
||||
|
||||
|
||||
def _all_to_all_seq_to_head(t: torch.Tensor, cp_size: int, cp_group: dist.ProcessGroup) -> torch.Tensor:
|
||||
"""Redistribute [S_local, H, D] -> [S_global, H_local, D].
|
||||
|
||||
Splits the head dim into cp_size groups and exchanges them so each rank
|
||||
ends up with the full sequence but only H/cp_size heads. Differentiable.
|
||||
"""
|
||||
s_local, h, d = t.shape
|
||||
assert h % cp_size == 0, f"num_heads ({h}) must be divisible by cp_size ({cp_size})"
|
||||
h_local = h // cp_size
|
||||
|
||||
# [S_local, cp_size, H_local, D] -> [cp_size, S_local, H_local, D]
|
||||
t = t.reshape(s_local, cp_size, h_local, d).transpose(0, 1).contiguous()
|
||||
output = torch.empty_like(t)
|
||||
out = dist_nn.all_to_all_single(output, t, group=cp_group)
|
||||
# out[i] is the chunk that source-rank i had at position my_rank, i.e.
|
||||
# source-rank i's local sequence shard for *my* head slice.
|
||||
return out.reshape(cp_size * s_local, h_local, d)
|
||||
|
||||
|
||||
def _all_to_all_head_to_seq(t: torch.Tensor, cp_size: int, cp_group: dist.ProcessGroup) -> torch.Tensor:
|
||||
"""Inverse of `_all_to_all_seq_to_head`: [S_global, H_local, D] -> [S_local, H, D]."""
|
||||
s_global, h_local, d = t.shape
|
||||
assert s_global % cp_size == 0
|
||||
s_local = s_global // cp_size
|
||||
h = h_local * cp_size
|
||||
|
||||
t = t.reshape(cp_size, s_local, h_local, d).contiguous()
|
||||
output = torch.empty_like(t)
|
||||
out = dist_nn.all_to_all_single(output, t, group=cp_group)
|
||||
# out[s']: original chunk for sequence-rank s' (which now becomes head-rank s').
|
||||
return out.transpose(0, 1).contiguous().reshape(s_local, h, d)
|
||||
|
||||
|
||||
def ulysses_flash_attn_varlen_func(
|
||||
flash_fn,
|
||||
q: torch.Tensor,
|
||||
k: torch.Tensor,
|
||||
v: torch.Tensor,
|
||||
cu_seqlens_q: torch.Tensor,
|
||||
cu_seqlens_k: torch.Tensor,
|
||||
max_seqlen_q: int,
|
||||
max_seqlen_k: int,
|
||||
causal: bool,
|
||||
cp_group: dist.ProcessGroup,
|
||||
cp_size: int,
|
||||
flash_attn_version: int = 2,
|
||||
window_size: tuple[int, int] = (-1, -1),
|
||||
softmax_scale: float | None = None,
|
||||
dropout_p: float = 0.0,
|
||||
deterministic: bool | None = None,
|
||||
) -> torch.Tensor:
|
||||
"""Run varlen flash attention under Ulysses CP.
|
||||
|
||||
`cu_seqlens_*` and `max_seqlen_*` describe the *full* (un-sharded) sequence,
|
||||
because after the seq->head all-to-all each rank holds the full sequence.
|
||||
"""
|
||||
q = _all_to_all_seq_to_head(q, cp_size, cp_group)
|
||||
k = _all_to_all_seq_to_head(k, cp_size, cp_group)
|
||||
v = _all_to_all_seq_to_head(v, cp_size, cp_group)
|
||||
|
||||
kwargs: dict = {"causal": causal}
|
||||
if window_size != (-1, -1):
|
||||
kwargs["window_size"] = window_size
|
||||
if softmax_scale is not None:
|
||||
kwargs["softmax_scale"] = softmax_scale
|
||||
if dropout_p:
|
||||
kwargs["dropout_p"] = dropout_p
|
||||
if deterministic is not None:
|
||||
kwargs["deterministic"] = deterministic
|
||||
|
||||
if flash_attn_version == 4:
|
||||
# FA4 takes cu_seqlens as keyword args (qv positional collides otherwise).
|
||||
kwargs["cu_seqlens_q"] = cu_seqlens_q
|
||||
kwargs["cu_seqlens_k"] = cu_seqlens_k
|
||||
out = flash_fn(q, k, v, **kwargs)
|
||||
else:
|
||||
out = flash_fn(q, k, v, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, **kwargs)
|
||||
if isinstance(out, tuple):
|
||||
out = out[0]
|
||||
|
||||
return _all_to_all_head_to_seq(out, cp_size, cp_group)
|
||||
|
||||
|
||||
def substitute_ulysses_attn(
|
||||
process_group: dist.ProcessGroup,
|
||||
attn_impl: str = "flash_attention_2",
|
||||
) -> None:
|
||||
"""Patch FlashAttention._compute_attention to do Ulysses all-to-all + local FA.
|
||||
|
||||
Mirrors `substitute_ring_attn` so swapping CP styles is a one-line change
|
||||
in the trainer.
|
||||
"""
|
||||
cp_size = dist.get_world_size(group=process_group)
|
||||
|
||||
# Resolve flash kernel + version from attn_impl.
|
||||
if attn_impl == "fa4":
|
||||
from flash_attn.cute import flash_attn_varlen_func as flash_fn
|
||||
|
||||
flash_attn_version = 4
|
||||
flash_fn = torch._dynamo.disable(flash_fn)
|
||||
elif attn_impl == "flash_attention_3":
|
||||
from flash_attn_interface import flash_attn_varlen_func as flash_fn
|
||||
|
||||
flash_attn_version = 3
|
||||
else:
|
||||
from flash_attn import flash_attn_varlen_func as flash_fn
|
||||
|
||||
flash_attn_version = 2
|
||||
|
||||
def _ulysses_compute_attention(self, q, k, v, cu_seqlens, max_seqlen):
|
||||
# cu_seqlens / max_seqlen passed in are for the *local* sharded sequence;
|
||||
# ulysses needs the *full* ones (each rank holds the full seq after a2a).
|
||||
cu_seqlens_full = ULYSSES_PARAMS["cu_seqlens"]
|
||||
max_seqlen_full = ULYSSES_PARAMS["max_seqlen"]
|
||||
|
||||
window_size = (-1, -1)
|
||||
sliding_window = getattr(self, "sliding_window", None)
|
||||
if sliding_window is not None:
|
||||
window_size = (sliding_window - 1, 0)
|
||||
|
||||
return ulysses_flash_attn_varlen_func(
|
||||
flash_fn,
|
||||
q,
|
||||
k,
|
||||
v,
|
||||
cu_seqlens_q=cu_seqlens_full,
|
||||
cu_seqlens_k=cu_seqlens_full,
|
||||
max_seqlen_q=max_seqlen_full,
|
||||
max_seqlen_k=max_seqlen_full,
|
||||
causal=True,
|
||||
cp_group=process_group,
|
||||
cp_size=cp_size,
|
||||
flash_attn_version=flash_attn_version,
|
||||
window_size=window_size,
|
||||
)
|
||||
|
||||
from prime_rl.trainer.models.layers.attn import FlashAttention
|
||||
|
||||
FlashAttention._compute_attention = _ulysses_compute_attention
|
||||
|
||||
from prime_rl.trainer.models.afmoe.modeling_afmoe import AfmoeFlashAttention
|
||||
|
||||
AfmoeFlashAttention._compute_attention = _ulysses_compute_attention
|
||||
|
||||
from prime_rl.trainer.models.qwen3_5_moe.modeling_qwen3_5_moe import Qwen3_5MoeGatedFlashAttention
|
||||
|
||||
Qwen3_5MoeGatedFlashAttention._compute_attention = _ulysses_compute_attention
|
||||
|
||||
|
||||
def substitute_hf_ulysses_attn(process_group: dist.ProcessGroup) -> None:
|
||||
"""Patch HF's `_flash_attention_forward` to use Ulysses all-to-all + local FA2.
|
||||
|
||||
Used for HF (non-custom) model paths, e.g. qwen2/qwen3 dense models. Mirrors
|
||||
ring_flash_attn's `substitute_hf_flash_attn` but with all-to-all instead of
|
||||
ring all-gather.
|
||||
"""
|
||||
import transformers
|
||||
import transformers.modeling_flash_attention_utils
|
||||
from flash_attn import flash_attn_varlen_func
|
||||
|
||||
cp_size = dist.get_world_size(group=process_group)
|
||||
|
||||
def _ulysses_flash_attention_forward(
|
||||
query_states: torch.Tensor,
|
||||
key_states: torch.Tensor,
|
||||
value_states: torch.Tensor,
|
||||
attention_mask,
|
||||
query_length: int,
|
||||
is_causal: bool,
|
||||
dropout: float = 0.0,
|
||||
position_ids=None,
|
||||
softmax_scale=None,
|
||||
sliding_window=None,
|
||||
use_top_left_mask: bool = False,
|
||||
softcap=None,
|
||||
deterministic=None,
|
||||
**kwargs,
|
||||
):
|
||||
assert is_causal, "ulysses CP only supports causal attention"
|
||||
assert softcap is None, "ulysses CP path does not support softcap"
|
||||
assert query_states.size(0) == 1, "varlen data should be processed with batch=1"
|
||||
|
||||
cu_seqlens = ULYSSES_PARAMS["cu_seqlens"]
|
||||
max_seqlen = ULYSSES_PARAMS["max_seqlen"]
|
||||
|
||||
window_size = (-1, -1)
|
||||
if sliding_window is not None and key_states.shape[1] > sliding_window:
|
||||
window_size = (sliding_window, sliding_window)
|
||||
|
||||
out = ulysses_flash_attn_varlen_func(
|
||||
flash_attn_varlen_func,
|
||||
query_states.squeeze(0),
|
||||
key_states.squeeze(0),
|
||||
value_states.squeeze(0),
|
||||
cu_seqlens_q=cu_seqlens,
|
||||
cu_seqlens_k=cu_seqlens,
|
||||
max_seqlen_q=max_seqlen,
|
||||
max_seqlen_k=max_seqlen,
|
||||
causal=True,
|
||||
cp_group=process_group,
|
||||
cp_size=cp_size,
|
||||
flash_attn_version=2,
|
||||
window_size=window_size,
|
||||
softmax_scale=softmax_scale,
|
||||
dropout_p=dropout,
|
||||
deterministic=deterministic,
|
||||
)
|
||||
return out.unsqueeze(0)
|
||||
|
||||
transformers.modeling_flash_attention_utils._flash_attention_forward = _ulysses_flash_attention_forward
|
||||
|
||||
# Newer transformers route attention through ALL_ATTENTION_FUNCTIONS["flash_attention_2"].
|
||||
try:
|
||||
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS
|
||||
except ImportError:
|
||||
ALL_ATTENTION_FUNCTIONS = None
|
||||
|
||||
if ALL_ATTENTION_FUNCTIONS is not None:
|
||||
|
||||
def _ulysses_flash_attention_forward_v2(
|
||||
module,
|
||||
query: torch.Tensor,
|
||||
key: torch.Tensor,
|
||||
value: torch.Tensor,
|
||||
attention_mask=None,
|
||||
dropout: float = 0.0,
|
||||
scaling=None,
|
||||
sliding_window=None,
|
||||
softcap=None,
|
||||
**kw,
|
||||
):
|
||||
# Match HF v2 entrypoint: query/key/value arrive as [B, H, S, D].
|
||||
seq_len = query.shape[2]
|
||||
query = query.transpose(1, 2)
|
||||
key = key.transpose(1, 2)
|
||||
value = value.transpose(1, 2)
|
||||
|
||||
kw.pop("is_causal", None)
|
||||
attn_out = _ulysses_flash_attention_forward(
|
||||
query,
|
||||
key,
|
||||
value,
|
||||
attention_mask,
|
||||
query_length=seq_len,
|
||||
is_causal=module.is_causal,
|
||||
dropout=dropout,
|
||||
softmax_scale=scaling,
|
||||
sliding_window=sliding_window,
|
||||
softcap=softcap,
|
||||
)
|
||||
return attn_out, None
|
||||
|
||||
ALL_ATTENTION_FUNCTIONS["flash_attention_2"] = _ulysses_flash_attention_forward_v2
|
||||
@@ -186,13 +186,32 @@ def train(config: TrainerConfig):
|
||||
if parallel_dims.cp_enabled:
|
||||
cp_group = parallel_dims.world_mesh["cp"].get_group()
|
||||
cp_rank = parallel_dims.world_mesh["cp"].get_local_rank()
|
||||
substitute_hf_flash_attn(cp_group, heads_k_stride=1)
|
||||
substitute_ring_attn(cp_group, heads_k_stride=1, attn_impl=config.model.attn)
|
||||
from prime_rl.utils.cp import setup_hybrid_cp, setup_nemotron_h_cp, setup_sparse_mla_cp
|
||||
if config.model.cp_style == "ring":
|
||||
substitute_hf_flash_attn(cp_group, heads_k_stride=1)
|
||||
substitute_ring_attn(cp_group, heads_k_stride=1, attn_impl=config.model.attn)
|
||||
else:
|
||||
from prime_rl.trainer.models.layers.ulysses_attn import (
|
||||
substitute_hf_ulysses_attn,
|
||||
substitute_ulysses_attn,
|
||||
)
|
||||
|
||||
setup_hybrid_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
substitute_hf_ulysses_attn(cp_group)
|
||||
substitute_ulysses_attn(cp_group, attn_impl=config.model.attn)
|
||||
from prime_rl.utils.cp import (
|
||||
assert_cp_style_supports_model,
|
||||
setup_hybrid_cp,
|
||||
setup_nemotron_h_cp,
|
||||
setup_sparse_mla_cp,
|
||||
)
|
||||
|
||||
assert_cp_style_supports_model(config.model.cp_style, model)
|
||||
# sparse MLA is softmax (works with both ring and ulysses).
|
||||
setup_sparse_mla_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
setup_nemotron_h_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
# Linear-attn / Mamba layers are only configured under ulysses; with ring
|
||||
# we'd have already raised above.
|
||||
if config.model.cp_style == "ulysses":
|
||||
setup_hybrid_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
setup_nemotron_h_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
|
||||
# Optionally, resume training from a checkpoint
|
||||
progress = Progress()
|
||||
@@ -371,7 +390,9 @@ def train(config: TrainerConfig):
|
||||
raise NotImplementedError("Context parallelism is not supported with VLM/multimodal training")
|
||||
|
||||
if cp_enabled:
|
||||
input_ids, forward_position_ids = setup_cp_params(input_ids, position_ids, cp_rank, cp_size, cp_group)
|
||||
input_ids, forward_position_ids = setup_cp_params(
|
||||
input_ids, position_ids, cp_rank, cp_size, cp_group, cp_style=config.model.cp_style
|
||||
)
|
||||
labels = shard_for_cp(labels, cp_rank=cp_rank, cp_world_size=cp_size)
|
||||
if routed_experts is not None:
|
||||
routed_experts = shard_for_cp(routed_experts, cp_rank=cp_rank, cp_world_size=cp_size)
|
||||
|
||||
@@ -107,8 +107,17 @@ def train(config: SFTConfig):
|
||||
assert config.data.seq_len % parallel_dims.cp == 0, "Sequence length must be divisible by CP degree"
|
||||
cp_group = parallel_dims.world_mesh["cp"].get_group()
|
||||
cp_rank = parallel_dims.world_mesh["cp"].get_local_rank()
|
||||
substitute_hf_flash_attn(cp_group, heads_k_stride=1)
|
||||
substitute_ring_attn(cp_group, heads_k_stride=1, attn_impl=config.model.attn)
|
||||
if config.model.cp_style == "ring":
|
||||
substitute_hf_flash_attn(cp_group, heads_k_stride=1)
|
||||
substitute_ring_attn(cp_group, heads_k_stride=1, attn_impl=config.model.attn)
|
||||
else:
|
||||
from prime_rl.trainer.models.layers.ulysses_attn import (
|
||||
substitute_hf_ulysses_attn,
|
||||
substitute_ulysses_attn,
|
||||
)
|
||||
|
||||
substitute_hf_ulysses_attn(cp_group)
|
||||
substitute_ulysses_attn(cp_group, attn_impl=config.model.attn)
|
||||
from prime_rl.utils.cp import setup_hybrid_cp, setup_nemotron_h_cp, setup_sparse_mla_cp
|
||||
|
||||
# Set up checkpoint manager
|
||||
@@ -129,9 +138,16 @@ def train(config: SFTConfig):
|
||||
model = setup_model(config.model, parallel_dims, loading_from_ckpt_later, fused_cross_entropy=fused_cross_entropy)
|
||||
|
||||
if parallel_dims.cp_enabled:
|
||||
setup_hybrid_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
from prime_rl.utils.cp import assert_cp_style_supports_model
|
||||
|
||||
assert_cp_style_supports_model(config.model.cp_style, model)
|
||||
# sparse MLA is softmax (works with both ring and ulysses).
|
||||
setup_sparse_mla_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
setup_nemotron_h_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
# Linear-attn / Mamba layers are only configured under ulysses; with ring
|
||||
# we'd have already raised above.
|
||||
if config.model.cp_style == "ulysses":
|
||||
setup_hybrid_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
setup_nemotron_h_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
|
||||
if config.model.lora is not None:
|
||||
multi_run_manager = get_multi_run_manager()
|
||||
@@ -213,7 +229,9 @@ def train(config: SFTConfig):
|
||||
loss_mask = micro_batch["loss_mask"].to("cuda")
|
||||
|
||||
if cp_enabled:
|
||||
input_ids, position_ids = setup_cp_params(input_ids, position_ids, cp_rank, cp_size, cp_group)
|
||||
input_ids, position_ids = setup_cp_params(
|
||||
input_ids, position_ids, cp_rank, cp_size, cp_group, cp_style=config.model.cp_style
|
||||
)
|
||||
target_ids = shard_for_cp(target_ids, cp_rank=cp_rank, cp_world_size=cp_size)
|
||||
loss_mask = shard_for_cp(loss_mask, cp_rank=cp_rank, cp_world_size=cp_size)
|
||||
|
||||
|
||||
+67
-24
@@ -3,6 +3,8 @@ from __future__ import annotations
|
||||
# ruff: noqa: I001 — `prime_rl._compat` must run before `ring_flash_attn` imports below.
|
||||
import prime_rl._compat # noqa: F401
|
||||
|
||||
from typing import Literal
|
||||
|
||||
import torch
|
||||
import torch.distributed as dist
|
||||
import torch.distributed.nn as dist_nn
|
||||
@@ -11,9 +13,47 @@ from ring_flash_attn import update_ring_flash_attn_params
|
||||
|
||||
from prime_rl.utils.sequence import get_cu_seqlens_from_position_ids
|
||||
|
||||
CPStyle = Literal["ring", "ulysses"]
|
||||
|
||||
|
||||
def _has_linear_attn_layer(model: nn.Module) -> bool:
|
||||
"""True if the model contains any non-softmax (linear/SSM) attention layer."""
|
||||
inner = getattr(model, "model", model)
|
||||
if hasattr(inner, "language_model"):
|
||||
inner = inner.language_model
|
||||
layers = getattr(inner, "layers", None)
|
||||
if layers is None:
|
||||
return False
|
||||
for layer in layers:
|
||||
# Qwen3.5 hybrid DeltaNet
|
||||
if getattr(layer, "layer_type", None) == "linear_attention":
|
||||
return True
|
||||
# NemotronH Mamba
|
||||
if hasattr(layer, "mamba"):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def assert_cp_style_supports_model(cp_style: CPStyle, model: nn.Module) -> None:
|
||||
"""Refuse `cp_style='ring'` on models that have linear/SSM attention layers.
|
||||
|
||||
Ring CP is a softmax-attention algorithm (sequence ring all-gather of K/V).
|
||||
For non-softmax layers (DeltaNet, Mamba) we'd need a fundamentally different
|
||||
CP scheme, which is not implemented. Use `cp_style='ulysses'` for those:
|
||||
ulysses' all-to-all is purely on Q/K/V tensors, so the linear/SSM kernel
|
||||
runs unchanged on a sequence shard.
|
||||
"""
|
||||
if cp_style == "ring" and _has_linear_attn_layer(model):
|
||||
raise ValueError(
|
||||
"cp_style='ring' is not supported for models with linear-attention "
|
||||
"or Mamba/SSM layers (e.g. Qwen3.5 hybrid, NemotronH). Use "
|
||||
"cp_style='ulysses' instead — its all-to-all on Q/K/V works "
|
||||
"out-of-the-box with non-softmax kernels."
|
||||
)
|
||||
|
||||
|
||||
def setup_hybrid_cp(model: nn.Module, cp_group: dist.ProcessGroup, cp_rank: int, cp_world_size: int) -> None:
|
||||
"""Configure DeltaNet modules in Qwen3.5 hybrid models for native fla CP."""
|
||||
"""Configure DeltaNet modules in Qwen3.5 hybrid models for ulysses-style CP."""
|
||||
layers = None
|
||||
if hasattr(model, "model"):
|
||||
inner = model.model
|
||||
@@ -42,7 +82,7 @@ def setup_hybrid_cp(model: nn.Module, cp_group: dist.ProcessGroup, cp_rank: int,
|
||||
|
||||
|
||||
def setup_nemotron_h_cp(model: nn.Module, cp_group: dist.ProcessGroup, cp_rank: int, cp_world_size: int) -> None:
|
||||
"""Configure NemotronH Mamba layers for context-parallel gather/scatter."""
|
||||
"""Configure NemotronH Mamba layers for ulysses-style all-to-all head partitioning."""
|
||||
layers = None
|
||||
if hasattr(model, "model") and hasattr(model.model, "layers"):
|
||||
layers = model.model.layers
|
||||
@@ -143,35 +183,38 @@ def get_padding_logit_from_prev_cp_rank(
|
||||
return None
|
||||
|
||||
|
||||
def _get_cu_seqlens_for_cp(position_ids: torch.Tensor) -> torch.Tensor:
|
||||
cu_seqlens, _ = get_cu_seqlens_from_position_ids(position_ids)
|
||||
return cu_seqlens
|
||||
|
||||
|
||||
def setup_cp_params(
|
||||
input_ids: torch.Tensor,
|
||||
position_ids: torch.Tensor,
|
||||
cp_rank: int,
|
||||
cp_world_size: int,
|
||||
cp_group: dist.ProcessGroup,
|
||||
cp_style: CPStyle = "ring",
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""
|
||||
Prepare the input for context parallelism and sets required parameters for ring flash attention.
|
||||
Args:
|
||||
input_ids: The input ids tensor.
|
||||
position_ids: The position ids tensor.
|
||||
cp_rank: The rank of the current process.
|
||||
cp_world_size: The number of processes in the context parallel group.
|
||||
cp_group: The context parallel group.
|
||||
Returns:
|
||||
The sharded input_ids and position_ids for context parallelism.
|
||||
"""
|
||||
input_ids = shard_for_cp(input_ids, cp_rank=cp_rank, cp_world_size=cp_world_size)
|
||||
Prepare the input for context parallelism and set required attention params.
|
||||
|
||||
cu_seqlens = _get_cu_seqlens_for_cp(position_ids)
|
||||
update_ring_flash_attn_params(cu_seqlens, cp_group)
|
||||
Both ring and ulysses styles need cu_seqlens computed from the *full*
|
||||
(un-sharded) position_ids, then publish them to the patched attention layer:
|
||||
- ring: via ring_flash_attn's DATA_PARAMS (with local_k_slice).
|
||||
- ulysses: via ULYSSES_PARAMS (just the full cu_seqlens / max_seqlen).
|
||||
|
||||
Returns the sequence-sharded input_ids and position_ids — the rest of the
|
||||
model still runs sequence-sharded; only attention sees the full sequence.
|
||||
"""
|
||||
cu_seqlens, max_seqlen = get_cu_seqlens_from_position_ids(position_ids)
|
||||
|
||||
if cp_style == "ring":
|
||||
update_ring_flash_attn_params(cu_seqlens, cp_group)
|
||||
elif cp_style == "ulysses":
|
||||
# Delayed import: ulysses_attn lives under trainer.models, which imports
|
||||
# back into prime_rl.utils — top-level import would deadlock at startup.
|
||||
from prime_rl.trainer.models.layers.ulysses_attn import update_ulysses_params
|
||||
|
||||
update_ulysses_params(cu_seqlens, max_seqlen)
|
||||
else:
|
||||
raise ValueError(f"Unknown cp_style: {cp_style}")
|
||||
|
||||
input_ids = shard_for_cp(input_ids, cp_rank=cp_rank, cp_world_size=cp_world_size)
|
||||
position_ids = shard_for_cp(position_ids, cp_rank=cp_rank, cp_world_size=cp_world_size)
|
||||
return (
|
||||
input_ids,
|
||||
position_ids,
|
||||
)
|
||||
return input_ids, position_ids
|
||||
|
||||
@@ -36,6 +36,10 @@ def test_convert_tt_layer_to_vllm_kernel_no_fp8():
|
||||
|
||||
assert "model.layers.0.self_attn.fused_qkv_a_proj.weight" in out
|
||||
assert out["model.layers.0.self_attn.fused_qkv_a_proj.weight"].shape == (7, 6)
|
||||
assert "model.layers.0.self_attn.indexer.wk_weights_proj.weight" in out
|
||||
assert out["model.layers.0.self_attn.indexer.wk_weights_proj.weight"].shape == (6, 6)
|
||||
assert "model.layers.0.self_attn.indexer.wk.weight" not in out
|
||||
assert "model.layers.0.self_attn.indexer.weights_proj.weight" not in out
|
||||
|
||||
assert "model.layers.0.mlp.gate_up_proj.weight" in out
|
||||
assert out["model.layers.0.mlp.gate_up_proj.weight"].shape == (16, 6)
|
||||
@@ -55,6 +59,8 @@ def test_convert_tt_layer_to_vllm_kernel_with_fp8():
|
||||
|
||||
assert out["model.layers.0.self_attn.fused_qkv_a_proj.weight"].dtype == torch.float8_e4m3fn
|
||||
assert out["model.layers.0.self_attn.fused_qkv_a_proj.weight_scale_inv"].dtype == torch.float32
|
||||
assert out["model.layers.0.self_attn.indexer.wk_weights_proj.weight"].dtype == torch.float32
|
||||
assert "model.layers.0.self_attn.indexer.wk.weight_scale_inv" not in out
|
||||
|
||||
assert out["model.layers.0.mlp.experts.w13_weight"].dtype == torch.float8_e4m3fn
|
||||
assert out["model.layers.0.mlp.experts.w13_weight_scale_inv"].dtype == torch.float32
|
||||
|
||||
@@ -11,7 +11,7 @@ supported-markers = [
|
||||
]
|
||||
|
||||
[options]
|
||||
exclude-newer = "2026-04-29T22:09:49.355713533Z"
|
||||
exclude-newer = "2026-05-03T13:45:58.065909043Z"
|
||||
exclude-newer-span = "P7D"
|
||||
|
||||
[options.exclude-newer-package]
|
||||
@@ -696,18 +696,18 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "deep-ep"
|
||||
version = "1.2.1+73b6ea4"
|
||||
source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl" }
|
||||
version = "1.2.1+29d31c0"
|
||||
source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl" }
|
||||
wheels = [
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl", hash = "sha256:ddf25e5d9c8543d27d7ae7a62ff7752560bf79c03c5991d48721352818b320d3" },
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl", hash = "sha256:a52b709d62c4dfc46a018b988724a7c10894125091aef596bf6d68e94c2b564e" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deep-gemm"
|
||||
version = "2.3.0+d30fc36"
|
||||
source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.3.0+d30fc36-cp312-cp312-linux_x86_64.whl" }
|
||||
version = "2.5.0+891d57b"
|
||||
source = { url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_x86_64.whl" }
|
||||
wheels = [
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.3.0+d30fc36-cp312-cp312-linux_x86_64.whl", hash = "sha256:dfa8dbeff3d820193f4f94b75f12734c7d73650495e9e8bbdb276953316db6f9" },
|
||||
{ url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_x86_64.whl", hash = "sha256:3a9e4472b86e8e7e2c77cc76951c886bbe7a23a1f5908958969ab5b9c707a2f3" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2778,7 +2778,8 @@ dependencies = [
|
||||
{ name = "transformers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "uvloop", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "vllm", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "vllm", version = "0.20.2+cu129", source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_aarch64.whl" }, marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "vllm", version = "0.20.2+cu129", source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_x86_64.whl" }, marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "wandb", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
@@ -2855,8 +2856,8 @@ requires-dist = [
|
||||
{ name = "code-env", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "color-codeword", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.3.0+d30fc36-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deepdive", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "dion", git = "https://github.com/samsja/dion.git?rev=d891eeb" },
|
||||
{ name = "flash-attn", marker = "platform_machine == 'x86_64' and extra == 'flash-attn'", url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.9.4/flash_attn-2.8.3+cu128torch2.11-cp312-cp312-linux_x86_64.whl" },
|
||||
@@ -2902,7 +2903,9 @@ requires-dist = [
|
||||
{ name = "transformers", git = "https://github.com/huggingface/transformers.git?rev=c1c3424" },
|
||||
{ name = "uvloop", specifier = ">=0.21.0" },
|
||||
{ name = "verifiers", git = "https://github.com/PrimeIntellect-ai/verifiers.git?rev=3b77145" },
|
||||
{ name = "vllm", specifier = ">=0.20.1" },
|
||||
{ name = "vllm", marker = "platform_machine != 'aarch64' and platform_machine != 'x86_64'", specifier = ">=0.20.2" },
|
||||
{ name = "vllm", marker = "platform_machine == 'aarch64'", url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_aarch64.whl" },
|
||||
{ name = "vllm", marker = "platform_machine == 'x86_64'", url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_x86_64.whl" },
|
||||
{ name = "vllm-router", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/router/releases/download/v0.1.22/vllm_router-0.1.22-cp38-abi3-manylinux_2_28_x86_64.whl" },
|
||||
{ name = "wandb", specifier = ">=0.26.1" },
|
||||
{ name = "wiki-search", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
@@ -4199,86 +4202,354 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "vllm"
|
||||
version = "0.20.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
version = "0.20.2+cu129"
|
||||
source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_aarch64.whl" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'aarch64' and sys_platform == 'linux'",
|
||||
]
|
||||
dependencies = [
|
||||
{ name = "aiohttp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "anthropic", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "apache-tvm-ffi", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "blake3", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "cachetools", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "cbor2", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "cloudpickle", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "compressed-tensors", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "depyf", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "diskcache", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "einops", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "fastapi", extra = ["standard"], marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "fastsafetensors", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "filelock", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "flashinfer-cubin", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "flashinfer-python", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "gguf", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "ijson", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "lark", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "llguidance", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "lm-format-enforcer", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "mcp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "mistral-common", extra = ["image"], marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "model-hosting-container-standards", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "msgspec", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "ninja", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "numba", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "numpy", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "nvidia-cudnn-frontend", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "nvidia-cutlass-dsl", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "openai", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "openai-harmony", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opencv-python-headless", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opentelemetry-api", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opentelemetry-exporter-otlp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opentelemetry-sdk", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "outlines-core", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "partial-json-parser", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "pillow", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "prometheus-client", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "prometheus-fastapi-instrumentator", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "protobuf", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "psutil", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "py-cpuinfo", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "pybase64", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "pydantic", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "python-json-logger", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "pyyaml", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "pyzmq", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "quack-kernels", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "regex", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "requests", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "sentencepiece", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "setproctitle", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "setuptools", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "six", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tiktoken", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tilelang", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tokenizers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "torch", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "torchaudio", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "torchvision", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tqdm", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "transformers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "watchfiles", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "xgrammar", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "aiohttp", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "anthropic", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "apache-tvm-ffi", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "blake3", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "cachetools", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "cbor2", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "cloudpickle", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "compressed-tensors", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "depyf", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "diskcache", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "einops", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "fastapi", extra = ["standard"], marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "fastsafetensors", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "filelock", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "flashinfer-cubin", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "flashinfer-python", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "gguf", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "ijson", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "lark", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "llguidance", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "lm-format-enforcer", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "mcp", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "mistral-common", extra = ["image"], marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "model-hosting-container-standards", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "msgspec", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "ninja", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "numba", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "numpy", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "nvidia-cudnn-frontend", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "nvidia-cutlass-dsl", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "openai", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "openai-harmony", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "opencv-python-headless", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-api", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-exporter-otlp", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-sdk", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "outlines-core", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "partial-json-parser", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "pillow", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "prometheus-client", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "prometheus-fastapi-instrumentator", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "protobuf", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "psutil", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "py-cpuinfo", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "pybase64", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "pydantic", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "python-json-logger", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "pyyaml", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "pyzmq", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "quack-kernels", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "regex", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "requests", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "sentencepiece", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "setproctitle", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "setuptools", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "six", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "tiktoken", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "tilelang", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "tokenizers", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "torch", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "torchaudio", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "torchvision", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "tqdm", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "transformers", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "typing-extensions", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "watchfiles", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "xgrammar", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/34/b4/32429ebde396149e5570c9a6b2e3b52dc47261d8b20465cc6ae36c4659fb/vllm-0.20.1.tar.gz", hash = "sha256:778df065237704d51e8b4cc95bcc6f6a0c2317f13feb38295de3ce76146bf140", size = 33519792, upload-time = "2026-05-03T08:24:43.794Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6e/2a/4bee1ddd867895e63bcca4f4ad78048f6a5d96d0ea241cdb70657cce966e/vllm-0.20.1-1-cp38-abi3-manylinux_2_35_aarch64.whl", hash = "sha256:4a5c24a94be8413ce682e72d6c22762ac7be64635cf191f4807d30910f928268", size = 235787780, upload-time = "2026-05-04T10:38:44.956Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/ae/55bb24db43e02a21fe98d64293a309d7cf67054785ac8e8ff2e60e59789e/vllm-0.20.1-1-cp38-abi3-manylinux_2_35_x86_64.whl", hash = "sha256:11907857c94c226caf82ada92ab09b1e0dbf538b5b80a93aed74be29e861020c", size = 244425444, upload-time = "2026-05-04T10:39:12.327Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a7/23/8b48eeee87d9e5589f11bf5139f768053b90c4f85a33cfb72655a30cd14a/vllm-0.20.1-cp38-abi3-manylinux_2_35_aarch64.whl", hash = "sha256:1cfa5f5654e4c7a8a9f949ef7a9597a63b9736129202c96c006434b57f511223", size = 235787697, upload-time = "2026-05-03T08:25:12.511Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/80/16ee5d248a795abefd1476d4884394e3d917c68096f8dd696a8216347a74/vllm-0.20.1-cp38-abi3-manylinux_2_35_x86_64.whl", hash = "sha256:da89341f2a07f49a2571edecbec612071839b04b6d7ea1e3bddb5347d47859df", size = 244425347, upload-time = "2026-05-03T08:25:32.198Z" },
|
||||
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_aarch64.whl", hash = "sha256:8a58a086c5c4ed2883eee36aaaf6b79c83463d02da3015454acf92afcc8e150e" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "aiohttp", specifier = ">=3.13.3" },
|
||||
{ name = "anthropic", specifier = ">=0.71.0" },
|
||||
{ name = "apache-tvm-ffi", specifier = "==0.1.9" },
|
||||
{ name = "av", marker = "extra == 'audio'" },
|
||||
{ name = "blake3" },
|
||||
{ name = "cachetools" },
|
||||
{ name = "cbor2" },
|
||||
{ name = "cloudpickle" },
|
||||
{ name = "compressed-tensors", specifier = "==0.15.0.1" },
|
||||
{ name = "datasets", marker = "extra == 'bench'" },
|
||||
{ name = "depyf", specifier = "==0.20.0" },
|
||||
{ name = "diskcache", specifier = "==5.6.3" },
|
||||
{ name = "einops" },
|
||||
{ name = "fastapi", extras = ["standard"], specifier = ">=0.115.0" },
|
||||
{ name = "fastsafetensors", specifier = ">=0.2.2" },
|
||||
{ name = "fastsafetensors", marker = "extra == 'fastsafetensors'", specifier = ">=0.2.2" },
|
||||
{ name = "filelock", specifier = ">=3.16.1" },
|
||||
{ name = "flashinfer-cubin", specifier = "==0.6.8.post1" },
|
||||
{ name = "flashinfer-python", specifier = "==0.6.8.post1" },
|
||||
{ name = "gguf", specifier = ">=0.17.0" },
|
||||
{ name = "helion", marker = "extra == 'helion'", specifier = "==1.0.0" },
|
||||
{ name = "ijson" },
|
||||
{ name = "instanttensor", marker = "extra == 'instanttensor'", specifier = ">=0.1.5" },
|
||||
{ name = "lark", specifier = "==1.2.2" },
|
||||
{ name = "llguidance", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 'x86_64'", specifier = ">=1.3.0,<1.4.0" },
|
||||
{ name = "lm-format-enforcer", specifier = "==0.11.3" },
|
||||
{ name = "matplotlib", marker = "extra == 'bench'" },
|
||||
{ name = "mcp" },
|
||||
{ name = "mistral-common", extras = ["audio"], marker = "extra == 'audio'" },
|
||||
{ name = "mistral-common", extras = ["image"], specifier = ">=1.11.0" },
|
||||
{ name = "model-hosting-container-standards", specifier = ">=0.1.13,<1.0.0" },
|
||||
{ name = "msgspec" },
|
||||
{ name = "ninja" },
|
||||
{ name = "numba", specifier = "==0.65.0" },
|
||||
{ name = "numpy" },
|
||||
{ name = "nvidia-cudnn-frontend", specifier = ">=1.13.0,<1.19.0" },
|
||||
{ name = "nvidia-cutlass-dsl", specifier = ">=4.4.2" },
|
||||
{ name = "openai", specifier = ">=2.0.0" },
|
||||
{ name = "openai-harmony", specifier = ">=0.0.3" },
|
||||
{ name = "opencv-python-headless", specifier = ">=4.13.0" },
|
||||
{ name = "opentelemetry-api", specifier = ">=1.27.0" },
|
||||
{ name = "opentelemetry-api", marker = "extra == 'otel'", specifier = ">=1.26.0" },
|
||||
{ name = "opentelemetry-exporter-otlp", specifier = ">=1.27.0" },
|
||||
{ name = "opentelemetry-exporter-otlp", marker = "extra == 'otel'", specifier = ">=1.26.0" },
|
||||
{ name = "opentelemetry-sdk", specifier = ">=1.27.0" },
|
||||
{ name = "opentelemetry-sdk", marker = "extra == 'otel'", specifier = ">=1.26.0" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", specifier = ">=0.4.1" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", marker = "extra == 'otel'", specifier = ">=0.4.1" },
|
||||
{ name = "outlines-core", specifier = "==0.2.14" },
|
||||
{ name = "pandas", marker = "extra == 'bench'" },
|
||||
{ name = "partial-json-parser" },
|
||||
{ name = "pillow" },
|
||||
{ name = "plotly", marker = "extra == 'bench'" },
|
||||
{ name = "prometheus-client", specifier = ">=0.18.0" },
|
||||
{ name = "prometheus-fastapi-instrumentator", specifier = ">=7.0.0" },
|
||||
{ name = "protobuf", specifier = ">=5.29.6,!=6.30.*,!=6.31.*,!=6.32.*,!=6.33.0.*,!=6.33.1.*,!=6.33.2.*,!=6.33.3.*,!=6.33.4.*" },
|
||||
{ name = "psutil" },
|
||||
{ name = "py-cpuinfo" },
|
||||
{ name = "pybase64" },
|
||||
{ name = "pydantic", specifier = ">=2.12.0" },
|
||||
{ name = "python-json-logger" },
|
||||
{ name = "pyyaml" },
|
||||
{ name = "pyzmq", specifier = ">=25.0.0" },
|
||||
{ name = "quack-kernels", specifier = ">=0.3.3" },
|
||||
{ name = "regex" },
|
||||
{ name = "requests", specifier = ">=2.26.0" },
|
||||
{ name = "runai-model-streamer", extras = ["azure", "gcs", "s3"], marker = "extra == 'runai'", specifier = ">=0.15.7" },
|
||||
{ name = "scipy", marker = "extra == 'audio'" },
|
||||
{ name = "scipy", marker = "extra == 'bench'" },
|
||||
{ name = "seaborn", marker = "extra == 'bench'" },
|
||||
{ name = "sentencepiece" },
|
||||
{ name = "setproctitle" },
|
||||
{ name = "setuptools", marker = "python_full_version >= '3.12'", specifier = ">=77.0.3,<81.0.0" },
|
||||
{ name = "six", marker = "python_full_version >= '3.12'", specifier = ">=1.16.0" },
|
||||
{ name = "smg-grpc-servicer", extras = ["vllm"], marker = "extra == 'grpc'", specifier = ">=0.5.2" },
|
||||
{ name = "soundfile", marker = "extra == 'audio'" },
|
||||
{ name = "tensorizer", marker = "extra == 'tensorizer'", specifier = "==2.10.1" },
|
||||
{ name = "tiktoken", specifier = ">=0.6.0" },
|
||||
{ name = "tilelang", specifier = "==0.1.9" },
|
||||
{ name = "tokenizers", specifier = ">=0.21.1" },
|
||||
{ name = "torch", specifier = "==2.11.0" },
|
||||
{ name = "torchaudio", specifier = "==2.11.0" },
|
||||
{ name = "torchvision", specifier = "==0.26.0" },
|
||||
{ name = "tqdm" },
|
||||
{ name = "transformers", specifier = ">=4.56.0,!=5.0.*,!=5.1.*,!=5.2.*,!=5.3.*,!=5.4.*,!=5.5.0" },
|
||||
{ name = "typing-extensions", specifier = ">=4.10" },
|
||||
{ name = "watchfiles" },
|
||||
{ name = "xgrammar", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 's390x' or platform_machine == 'x86_64'", specifier = ">=0.1.32,<1.0.0" },
|
||||
{ name = "zentorch-weekly", marker = "extra == 'zen'", specifier = "==5.2.1.dev20260408" },
|
||||
]
|
||||
provides-extras = ["zen", "bench", "tensorizer", "fastsafetensors", "instanttensor", "runai", "audio", "video", "flashinfer", "helion", "grpc", "otel"]
|
||||
|
||||
[[package]]
|
||||
name = "vllm"
|
||||
version = "0.20.2+cu129"
|
||||
source = { url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_x86_64.whl" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'x86_64' and sys_platform == 'linux'",
|
||||
]
|
||||
dependencies = [
|
||||
{ name = "aiohttp", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "anthropic", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "apache-tvm-ffi", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "blake3", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "cachetools", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "cbor2", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "cloudpickle", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "compressed-tensors", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "depyf", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "diskcache", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "einops", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "fastapi", extra = ["standard"], marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "fastsafetensors", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "filelock", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "flashinfer-cubin", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "flashinfer-python", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "gguf", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "ijson", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "lark", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "llguidance", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "lm-format-enforcer", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "mcp", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "mistral-common", extra = ["image"], marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "model-hosting-container-standards", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "msgspec", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "ninja", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "numba", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "numpy", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "nvidia-cudnn-frontend", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "nvidia-cutlass-dsl", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "openai", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "openai-harmony", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "opencv-python-headless", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-api", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-exporter-otlp", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-sdk", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "outlines-core", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "partial-json-parser", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "pillow", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "prometheus-client", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "prometheus-fastapi-instrumentator", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "protobuf", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "psutil", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "py-cpuinfo", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "pybase64", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "pydantic", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "python-json-logger", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "pyyaml", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "pyzmq", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "quack-kernels", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "regex", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "requests", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "sentencepiece", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "setproctitle", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "setuptools", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "six", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "tiktoken", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "tilelang", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "tokenizers", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "torch", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "torchaudio", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "torchvision", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "tqdm", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "transformers", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "typing-extensions", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "watchfiles", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "xgrammar", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://github.com/vllm-project/vllm/releases/download/v0.20.2/vllm-0.20.2+cu129-cp38-abi3-manylinux_2_31_x86_64.whl", hash = "sha256:2f8c2bf2ac6d3d16f930535e66822abd71065468521884eb5b910225b2abef4b" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "aiohttp", specifier = ">=3.13.3" },
|
||||
{ name = "anthropic", specifier = ">=0.71.0" },
|
||||
{ name = "apache-tvm-ffi", specifier = "==0.1.9" },
|
||||
{ name = "av", marker = "extra == 'audio'" },
|
||||
{ name = "blake3" },
|
||||
{ name = "cachetools" },
|
||||
{ name = "cbor2" },
|
||||
{ name = "cloudpickle" },
|
||||
{ name = "compressed-tensors", specifier = "==0.15.0.1" },
|
||||
{ name = "datasets", marker = "extra == 'bench'" },
|
||||
{ name = "depyf", specifier = "==0.20.0" },
|
||||
{ name = "diskcache", specifier = "==5.6.3" },
|
||||
{ name = "einops" },
|
||||
{ name = "fastapi", extras = ["standard"], specifier = ">=0.115.0" },
|
||||
{ name = "fastsafetensors", specifier = ">=0.2.2" },
|
||||
{ name = "fastsafetensors", marker = "extra == 'fastsafetensors'", specifier = ">=0.2.2" },
|
||||
{ name = "filelock", specifier = ">=3.16.1" },
|
||||
{ name = "flashinfer-cubin", specifier = "==0.6.8.post1" },
|
||||
{ name = "flashinfer-python", specifier = "==0.6.8.post1" },
|
||||
{ name = "gguf", specifier = ">=0.17.0" },
|
||||
{ name = "helion", marker = "extra == 'helion'", specifier = "==1.0.0" },
|
||||
{ name = "ijson" },
|
||||
{ name = "instanttensor", marker = "extra == 'instanttensor'", specifier = ">=0.1.5" },
|
||||
{ name = "lark", specifier = "==1.2.2" },
|
||||
{ name = "llguidance", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 'x86_64'", specifier = ">=1.3.0,<1.4.0" },
|
||||
{ name = "lm-format-enforcer", specifier = "==0.11.3" },
|
||||
{ name = "matplotlib", marker = "extra == 'bench'" },
|
||||
{ name = "mcp" },
|
||||
{ name = "mistral-common", extras = ["audio"], marker = "extra == 'audio'" },
|
||||
{ name = "mistral-common", extras = ["image"], specifier = ">=1.11.0" },
|
||||
{ name = "model-hosting-container-standards", specifier = ">=0.1.13,<1.0.0" },
|
||||
{ name = "msgspec" },
|
||||
{ name = "ninja" },
|
||||
{ name = "numba", specifier = "==0.65.0" },
|
||||
{ name = "numpy" },
|
||||
{ name = "nvidia-cudnn-frontend", specifier = ">=1.13.0,<1.19.0" },
|
||||
{ name = "nvidia-cutlass-dsl", specifier = ">=4.4.2" },
|
||||
{ name = "openai", specifier = ">=2.0.0" },
|
||||
{ name = "openai-harmony", specifier = ">=0.0.3" },
|
||||
{ name = "opencv-python-headless", specifier = ">=4.13.0" },
|
||||
{ name = "opentelemetry-api", specifier = ">=1.27.0" },
|
||||
{ name = "opentelemetry-api", marker = "extra == 'otel'", specifier = ">=1.26.0" },
|
||||
{ name = "opentelemetry-exporter-otlp", specifier = ">=1.27.0" },
|
||||
{ name = "opentelemetry-exporter-otlp", marker = "extra == 'otel'", specifier = ">=1.26.0" },
|
||||
{ name = "opentelemetry-sdk", specifier = ">=1.27.0" },
|
||||
{ name = "opentelemetry-sdk", marker = "extra == 'otel'", specifier = ">=1.26.0" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", specifier = ">=0.4.1" },
|
||||
{ name = "opentelemetry-semantic-conventions-ai", marker = "extra == 'otel'", specifier = ">=0.4.1" },
|
||||
{ name = "outlines-core", specifier = "==0.2.14" },
|
||||
{ name = "pandas", marker = "extra == 'bench'" },
|
||||
{ name = "partial-json-parser" },
|
||||
{ name = "pillow" },
|
||||
{ name = "plotly", marker = "extra == 'bench'" },
|
||||
{ name = "prometheus-client", specifier = ">=0.18.0" },
|
||||
{ name = "prometheus-fastapi-instrumentator", specifier = ">=7.0.0" },
|
||||
{ name = "protobuf", specifier = ">=5.29.6,!=6.30.*,!=6.31.*,!=6.32.*,!=6.33.0.*,!=6.33.1.*,!=6.33.2.*,!=6.33.3.*,!=6.33.4.*" },
|
||||
{ name = "psutil" },
|
||||
{ name = "py-cpuinfo" },
|
||||
{ name = "pybase64" },
|
||||
{ name = "pydantic", specifier = ">=2.12.0" },
|
||||
{ name = "python-json-logger" },
|
||||
{ name = "pyyaml" },
|
||||
{ name = "pyzmq", specifier = ">=25.0.0" },
|
||||
{ name = "quack-kernels", specifier = ">=0.3.3" },
|
||||
{ name = "regex" },
|
||||
{ name = "requests", specifier = ">=2.26.0" },
|
||||
{ name = "runai-model-streamer", extras = ["azure", "gcs", "s3"], marker = "extra == 'runai'", specifier = ">=0.15.7" },
|
||||
{ name = "scipy", marker = "extra == 'audio'" },
|
||||
{ name = "scipy", marker = "extra == 'bench'" },
|
||||
{ name = "seaborn", marker = "extra == 'bench'" },
|
||||
{ name = "sentencepiece" },
|
||||
{ name = "setproctitle" },
|
||||
{ name = "setuptools", marker = "python_full_version >= '3.12'", specifier = ">=77.0.3,<81.0.0" },
|
||||
{ name = "six", marker = "python_full_version >= '3.12'", specifier = ">=1.16.0" },
|
||||
{ name = "smg-grpc-servicer", extras = ["vllm"], marker = "extra == 'grpc'", specifier = ">=0.5.2" },
|
||||
{ name = "soundfile", marker = "extra == 'audio'" },
|
||||
{ name = "tensorizer", marker = "extra == 'tensorizer'", specifier = "==2.10.1" },
|
||||
{ name = "tiktoken", specifier = ">=0.6.0" },
|
||||
{ name = "tilelang", specifier = "==0.1.9" },
|
||||
{ name = "tokenizers", specifier = ">=0.21.1" },
|
||||
{ name = "torch", specifier = "==2.11.0" },
|
||||
{ name = "torchaudio", specifier = "==2.11.0" },
|
||||
{ name = "torchvision", specifier = "==0.26.0" },
|
||||
{ name = "tqdm" },
|
||||
{ name = "transformers", specifier = ">=4.56.0,!=5.0.*,!=5.1.*,!=5.2.*,!=5.3.*,!=5.4.*,!=5.5.0" },
|
||||
{ name = "typing-extensions", specifier = ">=4.10" },
|
||||
{ name = "watchfiles" },
|
||||
{ name = "xgrammar", marker = "platform_machine == 'aarch64' or platform_machine == 'arm64' or platform_machine == 'ppc64le' or platform_machine == 's390x' or platform_machine == 'x86_64'", specifier = ">=0.1.32,<1.0.0" },
|
||||
{ name = "zentorch-weekly", marker = "extra == 'zen'", specifier = "==5.2.1.dev20260408" },
|
||||
]
|
||||
provides-extras = ["zen", "bench", "tensorizer", "fastsafetensors", "instanttensor", "runai", "audio", "video", "flashinfer", "helion", "grpc", "otel"]
|
||||
|
||||
[[package]]
|
||||
name = "vllm-router"
|
||||
version = "0.1.22"
|
||||
|
||||
Reference in New Issue
Block a user