Files
wangdongyun cae3d108f3 chore: keep only launch-time logic, drop image-library patches
Remove the two patches that modified files inside the image and were not
related to the sliding-window / tokenizer fixes:

- patch_ops.py + patched_ops/ (injected gelu_tanh_and_mul into ixformer)
- detect_head_size.py (rewrote vllm paged_attn.py at startup)

Neither had a hit in the recent failure corpus, and both touched the
image's libraries. The build now only installs the launcher scripts; the
container still decides tokenizer source and serve flags at startup.
2026-11-10 22:20:23 +00:00

35 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# 构建期脚本:把运行期文件装到 /opt,并做最基本的完整性校验。
#
# 用法(Dockerfile):bash install_patch.sh /tmp
#
# 刻意**不修改镜像里的任何库**:这个引擎只在容器启动时决定「用哪个 tokenizer、
# 传哪些启动参数」,vLLM / ixformer / xformers 的代码一行都不动。因此这里只做:
# 1. 安装运行期脚本到 /opt;
# 2. 校验 vllm 可执行文件存在、脚本能编译(避免产出「装了个坏脚本」的镜像)。
set -euo pipefail
SRC_DIR="${1:-/tmp}"
echo "[install_patch] installing runtime files to /opt"
install -m 0644 "$SRC_DIR/fix_tokenizer.py" /opt/fix_tokenizer.py
install -m 0644 "$SRC_DIR/swa_guard.py" /opt/swa_guard.py
install -m 0644 "$SRC_DIR/vllm_launch.py" /opt/vllm_launch.py
install -m 0755 "$SRC_DIR/entrypoint.sh" /opt/entrypoint.sh
echo "[install_patch] verifying"
if ! command -v vllm >/dev/null 2>&1; then
echo "ERROR: vllm executable not found on PATH" >&2
exit 1
fi
python3 -m py_compile \
/opt/fix_tokenizer.py \
/opt/swa_guard.py \
/opt/vllm_launch.py
rm -rf /opt/__pycache__
echo "[install_patch] done (vllm: $(command -v vllm))"