[ARCH] Eliminate 2 more patch scripts — registry.py + tool_parsers __init__.py

Full file replacements for:
  - registry.py (453 lines): Qwen3_5ForCausalLM + Qwen3_5MoeForCausalLM
    pre-registered in _TEXT_GENERATION_MODELS dict
  - tool_parsers/__init__.py: Qwen3CoderToolParser pre-imported + exported

Eliminated: patch_vllm_qwen3_5.py, patch_vllm_tool_parser.py

Remaining: patch_transformers_qwen3_5.py (1 script) — this one modifies
pip-installed transformers' configuration_auto.py which is version-specific
and can't be pre-copied. Documented in patch_ops.sh.

Score: 5/6 patch scripts eliminated. Only 1 remains (unavoidable).
This commit is contained in:
dylanyunlon
2026-08-05 08:36:45 +00:00
parent 503009596d
commit f3810c53ae
3 changed files with 480 additions and 4 deletions

View File

@@ -67,6 +67,10 @@ cp ./sampler.py $V/model_executor/layers/sampler.py
echo "[patch_ops] sampler.py → model_executor/layers/"
# --- transformers: Qwen3_5 tokenizer / model files --------------------------
# NOTE: patch_transformers_qwen3_5.py is the ONLY remaining patch script.
# It modifies pip-installed transformers' configuration_auto.py and __init__.py
# to register qwen3_5/qwen3_5_moe. These files come from pip (version-specific)
# so we can't pre-copy them — the patch script inserts lines after known anchors.
pip install transformers==4.55.3 -i https://pypi.tuna.tsinghua.edu.cn/simple
cp -r ./qwen3_5 /usr/local/lib/python3.10/site-packages/transformers/models/
cp -r ./qwen3_5_moe /usr/local/lib/python3.10/site-packages/transformers/models/
@@ -74,10 +78,12 @@ python3 ./patch_transformers_qwen3_5.py
echo "[patch_ops] transformers Qwen3_5 models installed"
# --- vllm model: Qwen3.6 (Qwen3_5 arch) ------------------------------------
# FULL FILE REPLACEMENT of registry.py with Qwen3_5 entries pre-added.
# No more patch_vllm_qwen3_5.py script.
cp ./mamba_cache.py $V/model_executor/models/
cp ./qwen3_5.py $V/model_executor/models/qwen3_5.py
python3 ./patch_vllm_qwen3_5.py
echo "[patch_ops] qwen3_5.py model registered"
cp ./registry.py $V/model_executor/models/registry.py
echo "[patch_ops] qwen3_5.py + registry.py deployed"
# --- sequence.py: fix completion_tokens inflation ----------------------------
cp ./sequence.py $V/sequence.py
@@ -88,9 +94,11 @@ cp ./scheduler.py $V/core/scheduler.py
echo "[patch_ops] scheduler.py → core/"
# --- tool parser: Qwen3 XML tool call format --------------------------------
# FULL FILE REPLACEMENT of __init__.py with Qwen3CoderToolParser pre-added.
# No more patch_vllm_tool_parser.py script.
cp ./qwen3coder_tool_parser.py $V/entrypoints/openai/tool_parsers/
python3 ./patch_vllm_tool_parser.py
echo "[patch_ops] qwen3_coder tool parser registered"
cp ./tool_parsers_init.py $V/entrypoints/openai/tool_parsers/__init__.py
echo "[patch_ops] qwen3_coder tool parser deployed"
# --- reasoning parser: Qwen3 <think>...</think> split -----------------------
cp -r ./reasoning $V/