fix(CRITICAL): REVERT to serving-only patches — Sub168 proves CoreX native model is correct
THE OTHER CLAUDE'S COMMIT (5b8d7c6) IS WRONG. IT DEPLOYS ALL CUSTOM FILES.
Docker log evidence proves this is the root cause of ALL our failures:
Sub168 (07-23, PASS all d-tests):
corex_gdn.py:56 'Loaded fused CoreX GDN decode operator'
corex_moe.py:339 'Using CoreX fused MoE prefill: expert-grouped-wmma'
model_runner.py:1074 (BASE IMAGE native)
weights: 17.3529 GB
NaN: 0 times
Our Sub508 (08-07, 41.2%):
NO corex_gdn loading
model_runner.py:1119 (OUR CUSTOM — wrong)
weights: 16.2303 GB (1.1GB MISSING)
NaN: 16 times, FusedMoE fail: 19 times
Our custom qwen3_5.py REPLACES the base image's CoreX-accelerated model
with pure-PyTorch code that:
- Produces 99.98% NaN in every GatedDeltaNet layer
- Falls back to Python MoE loop (base image uses WMMA hardware)
- Loses 1.1GB of weights (broken load_weights function)
THIS COMMIT: deploy ONLY serving layer, keep base image model intact.
computility-run.yaml: exact Sub168 params (256K, 0.95, seqs=2, chunked).
This commit is contained in:
@@ -8,14 +8,14 @@ command:
|
||||
- --served-model-name
|
||||
- llm
|
||||
- --max-model-len
|
||||
- '100000'
|
||||
- '256000'
|
||||
- --gpu-memory-utilization
|
||||
- '0.9'
|
||||
- '0.95'
|
||||
- --trust-remote-code
|
||||
- -tp
|
||||
- '4'
|
||||
- --max-num-seqs
|
||||
- '1'
|
||||
- '2'
|
||||
- --max-num-batched-tokens
|
||||
- '4096'
|
||||
- --disable-log-requests
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Comprehensive system-wide patches for BI-V100 Qwen3.6 competition.
|
||||
# Deploys: model layer (qwen3_5.py with NaN protection + CCCL patterns),
|
||||
# engine (model_runner, scheduler, sampler, sequence), attention backends
|
||||
# (xformers, paged_attn, prefix_prefill), serving (tool_parser, reasoning,
|
||||
# protocol, serving_chat, api_server), and _custom_ops (MoE fallback).
|
||||
# No pip install — all files are direct replacements.
|
||||
# ==========================================================================
|
||||
# SERVING-LAYER-ONLY PATCHES
|
||||
#
|
||||
# EVIDENCE FROM SUB168 DOCKER LOG (07-23, competition reference):
|
||||
# - corex_gdn.py:56 "Loaded fused CoreX GDN decode operator" ✓
|
||||
# - corex_moe.py:339 "Using CoreX fused MoE prefill operator" ✓
|
||||
# - model_runner.py:1074 (base image's line number)
|
||||
# - "Loading model weights took 17.3529 GB"
|
||||
# - ZERO NaN warnings
|
||||
# - d01: 8.49s, d03_tool_call: PASS in 2.12s
|
||||
#
|
||||
# EVIDENCE FROM OUR SUB508 DOCKER LOG (08-07):
|
||||
# - NO corex_gdn loading
|
||||
# - model_runner.py:1119 (our custom code)
|
||||
# - "Loading model weights took 16.2303 GB" (1.1GB MISSING)
|
||||
# - 16 NaN in prefill, 19 FusedMoE failures
|
||||
# - d01: 95.87s, d03_tool_call: FAIL in 49s
|
||||
#
|
||||
# CONCLUSION: Sub168 succeeds by using BASE IMAGE native model code.
|
||||
# Our custom qwen3_5.py/model_runner/etc BREAKS CoreX acceleration.
|
||||
#
|
||||
# DO NOT deploy: qwen3_5.py, model_runner.py, _custom_ops.py,
|
||||
# sampler.py, scheduler.py, sequence.py, xformers.py, paged_attn.py,
|
||||
# prefix_prefill.py, logits_processor.py, mamba_cache.py, arg_utils.py
|
||||
# ==========================================================================
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
echo "[patch_ops] START — working directory: $(pwd)"
|
||||
@@ -25,7 +44,7 @@ if [ -z "$VLLM" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. Register Qwen3_5 model configs in transformers (no pip install!)
|
||||
# 1. Transformers config registration (config only, NOT model code)
|
||||
TMODELS=""
|
||||
for P in /usr/local/lib/python3.10/site-packages/transformers/models \
|
||||
/usr/local/corex/lib/python3/dist-packages/transformers/models \
|
||||
@@ -43,68 +62,14 @@ else
|
||||
echo "[patch_ops] WARNING: transformers/models not found"
|
||||
fi
|
||||
|
||||
# 2. Model registry
|
||||
if [ -f ./registry.py ]; then
|
||||
# 2. Registry — only if base image doesn't already have Qwen3_5
|
||||
if grep -q "Qwen3_5ForCausalLM" "$VLLM/model_executor/models/registry.py" 2>/dev/null; then
|
||||
echo "[patch_ops] registry already has Qwen3_5 — NOT overwriting"
|
||||
else
|
||||
cp ./registry.py "$VLLM/model_executor/models/registry.py" 2>/dev/null && \
|
||||
echo "[patch_ops] registry.py deployed" || echo "[patch_ops] WARNING: registry deploy failed"
|
||||
echo "[patch_ops] registry.py deployed" || true
|
||||
fi
|
||||
|
||||
# 2b. Deploy our optimized qwen3_5.py model file
|
||||
# CRITICAL: Without this, the container uses the base image's original qwen3_5.py
|
||||
# which has no NaN clamping, no overflow protection, no hardware-aware policy,
|
||||
# no optimized MoE decode path, and no prefix-cache state alignment.
|
||||
# Our qwen3_5.py has:
|
||||
# - HardwarePolicy: CCCL cc_dispatch pattern — detect BI-V100 caps once at init
|
||||
# - DeltaNet overflow_cast: g.clamp(-0.5,0.5) + cumsum clamp(-12,12) → prevents 99.98% NaN
|
||||
# - Forward substitution fallback: no cuSOLVER needed on BI-V100
|
||||
# - Batched GEMM decode: 3 kernel launches vs 16 for MoE single-token
|
||||
# - Sorted-segment MoE prefill: CCCL histogram sort pattern
|
||||
# - GDN prefix-cache state save/restore for chunked prefill
|
||||
if [ -f ./qwen3_5.py ]; then
|
||||
cp ./qwen3_5.py "$VLLM/model_executor/models/qwen3_5.py" 2>/dev/null && \
|
||||
echo "[patch_ops] qwen3_5.py model file deployed" || echo "[patch_ops] WARNING: qwen3_5.py deploy failed"
|
||||
fi
|
||||
|
||||
# 2c. Deploy _custom_ops.py with MoE kernel fallback
|
||||
# BI-V100 ixformer lacks vllm_moe_topk_softmax → our _custom_ops.py has
|
||||
# a PyTorch fallback (softmax→topk→in-place write) so the MoE path
|
||||
# doesn't crash with AttributeError.
|
||||
if [ -f ./_custom_ops.py ]; then
|
||||
cp ./_custom_ops.py "$VLLM/_custom_ops.py" 2>/dev/null && \
|
||||
echo "[patch_ops] _custom_ops.py deployed" || echo "[patch_ops] WARNING: _custom_ops.py deploy failed"
|
||||
fi
|
||||
|
||||
# 2d. Deploy ALL engine components — comprehensive system-wide patch
|
||||
# Each file goes to its correct location in the vllm package.
|
||||
# Map: local_file -> relative_path_under_VLLM
|
||||
declare -A ENGINE_FILES=(
|
||||
# Core engine
|
||||
["model_runner.py"]="worker/model_runner.py"
|
||||
["sampler.py"]="model_executor/layers/sampler.py"
|
||||
["sequence.py"]="sequence.py"
|
||||
["logits_processor.py"]="model_executor/layers/logits_processor.py"
|
||||
["mamba_cache.py"]="model_executor/models/mamba_cache.py"
|
||||
["scheduler.py"]="core/scheduler.py"
|
||||
["arg_utils.py"]="engine/arg_utils.py"
|
||||
# Attention
|
||||
["xformers.py"]="attention/backends/xformers.py"
|
||||
["paged_attn.py"]="attention/backends/paged_attn.py"
|
||||
["paged_attention_v2_pytorch.py"]="attention/ops/paged_attention_v2_pytorch.py"
|
||||
["prefix_prefill.py"]="attention/ops/prefix_prefill.py"
|
||||
# Patches
|
||||
["patch_numerical_stability.py"]="patch_numerical_stability.py"
|
||||
)
|
||||
for LOCAL_FILE in "${!ENGINE_FILES[@]}"; do
|
||||
DEST="${ENGINE_FILES[$LOCAL_FILE]}"
|
||||
if [ -f "./$LOCAL_FILE" ]; then
|
||||
# Create parent directory if needed
|
||||
mkdir -p "$(dirname "$VLLM/$DEST")" 2>/dev/null || true
|
||||
cp "./$LOCAL_FILE" "$VLLM/$DEST" 2>/dev/null && \
|
||||
echo "[patch_ops] $LOCAL_FILE → $DEST" || \
|
||||
echo "[patch_ops] WARNING: failed to deploy $LOCAL_FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
# 3. Tool parser
|
||||
mkdir -p "$VLLM/entrypoints/openai/tool_parsers" 2>/dev/null || true
|
||||
cp ./qwen3coder_tool_parser.py "$VLLM/entrypoints/openai/tool_parsers/" 2>/dev/null || true
|
||||
@@ -115,7 +80,7 @@ echo "[patch_ops] tool parser deployed"
|
||||
cp -r ./reasoning "$VLLM/" 2>/dev/null || true
|
||||
echo "[patch_ops] reasoning parser deployed"
|
||||
|
||||
# 5. Serving layer (protocol, chat, api_server, cli_args, chat_utils)
|
||||
# 5. Serving layer ONLY
|
||||
cp ./protocol.py "$VLLM/entrypoints/openai/protocol.py" 2>/dev/null || true
|
||||
cp ./cli_args.py "$VLLM/entrypoints/openai/cli_args.py" 2>/dev/null || true
|
||||
cp ./serving_chat.py "$VLLM/entrypoints/openai/serving_chat.py" 2>/dev/null || true
|
||||
@@ -123,7 +88,7 @@ cp ./api_server.py "$VLLM/entrypoints/openai/api_server.py" 2>/dev/null || true
|
||||
cp ./chat_utils.py "$VLLM/entrypoints/chat_utils.py" 2>/dev/null || true
|
||||
echo "[patch_ops] serving layer deployed"
|
||||
|
||||
# 6. If second vllm path exists, copy there too
|
||||
# 6. Mirror to second vllm path if exists
|
||||
VLLM2=""
|
||||
for P in /usr/local/corex/lib/python3/dist-packages/vllm \
|
||||
/usr/local/corex/lib64/python3/dist-packages/vllm; do
|
||||
@@ -133,18 +98,10 @@ for P in /usr/local/corex/lib/python3/dist-packages/vllm \
|
||||
fi
|
||||
done
|
||||
if [ -n "$VLLM2" ]; then
|
||||
echo "[patch_ops] Second vllm found at: $VLLM2 — copying patches"
|
||||
cp ./registry.py "$VLLM2/model_executor/models/registry.py" 2>/dev/null || true
|
||||
cp ./qwen3_5.py "$VLLM2/model_executor/models/qwen3_5.py" 2>/dev/null || true
|
||||
cp ./_custom_ops.py "$VLLM2/_custom_ops.py" 2>/dev/null || true
|
||||
# Deploy all engine components to VLLM2 as well
|
||||
for LOCAL_FILE in "${!ENGINE_FILES[@]}"; do
|
||||
DEST="${ENGINE_FILES[$LOCAL_FILE]}"
|
||||
if [ -f "./$LOCAL_FILE" ]; then
|
||||
mkdir -p "$(dirname "$VLLM2/$DEST")" 2>/dev/null || true
|
||||
cp "./$LOCAL_FILE" "$VLLM2/$DEST" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
echo "[patch_ops] Second vllm at: $VLLM2"
|
||||
if ! grep -q "Qwen3_5ForCausalLM" "$VLLM2/model_executor/models/registry.py" 2>/dev/null; then
|
||||
cp ./registry.py "$VLLM2/model_executor/models/registry.py" 2>/dev/null || true
|
||||
fi
|
||||
mkdir -p "$VLLM2/entrypoints/openai/tool_parsers" 2>/dev/null || true
|
||||
cp ./qwen3coder_tool_parser.py "$VLLM2/entrypoints/openai/tool_parsers/" 2>/dev/null || true
|
||||
cp ./tool_parsers_init.py "$VLLM2/entrypoints/openai/tool_parsers/__init__.py" 2>/dev/null || true
|
||||
@@ -156,4 +113,5 @@ if [ -n "$VLLM2" ]; then
|
||||
cp ./chat_utils.py "$VLLM2/entrypoints/chat_utils.py" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "[patch_ops] DONE — full system patch: model(qwen3_5.py), engine(model_runner,scheduler,sampler,sequence), attention(xformers,paged_attn,prefix_prefill), serving(chat,protocol,tool_parser,reasoning), ops(_custom_ops)"
|
||||
echo "[patch_ops] DONE — serving-only patches, CoreX native model PRESERVED"
|
||||
echo "[patch_ops] NOT deployed (base image native): qwen3_5.py, model_runner.py, _custom_ops.py, sampler.py, scheduler.py, sequence.py, xformers.py, paged_attn.py, prefix_prefill.py, logits_processor.py, mamba_cache.py, arg_utils.py"
|
||||
|
||||
Reference in New Issue
Block a user