Files
enginex-bi100-compat/Dockerfile

49 lines
3.2 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# enginex-bi100-compat
#
# 天数智芯 天垓100(Iluvatar_bi-100)· 文本生成 · vLLM「兼容增强」引擎。
#
# 不动模型、不动卡,只把「引擎镜像层」的结构性不兼容在容器启动前修掉。
# 做法照搬社区已上线引擎 zhengzhongwei/vLLM-Iluvatar_bi-100-opt:
# **把镜像内的 vllm 二进制换成本仓的 wrapper**,平台原样下发
# `vllm serve /model --port 80 ...` 就会流经 wrapper,无需平台改任何命令。
#
# 修什么(全部有日志实证,见 README.md):
# R3 extra_special_tokens 是 list -> transformers 崩(社区已上线修复,已合并)
# R3b tokenizer_class 是坏类名 -> 加载异常(社区已上线修复,已合并)
# R2 模型没有 chat_template -> /v1/chat/completions 400/空输出
# R4 architectures 是镜像未注册类名 -> KeyError / MODEL_NOT_SUPPORTED
# R7 镜像缺 ixformer.contrib.vllm.layers -> ModuleNotFoundError(MoE)
#
# 基线镜像与 zhengzhongwei/vLLM-Iluvatar_bi-100-opt 一致(平台 bi-100 vllm 框架在用的那个),
# 保证替换 vllm 二进制的路径与行为可预期。
FROM harbor-contest.4pd.io/luopingyi/bi100/vllm:0.6.3
LABEL org.opencontainers.image.title="enginex-bi100-compat" \
org.opencontainers.image.description="Iluvatar bi-100 vLLM engine with preflight compatibility patches (R2/R3/R3b/R4/R7)" \
com.modelhubxc.engine.target-card="Iluvatar_bi-100" \
com.modelhubxc.engine.framework="vllm" \
com.modelhubxc.engine.task-type="text-generation" \
com.modelhubxc.engine.pattern="zhengzhongwei/vLLM-Iluvatar_bi-100-opt"
# 修补脚本 + R7 纯 PyTorch shim(都是小文本文件,无权重)
COPY preflight.py /opt/
COPY detect_tokenizer.py /opt/
COPY vllm_wrapper.sh /opt/
COPY shims_ixformer_layers.py /opt/shims_src/
# 组装 ixformer.contrib.vllm.layers 包(R7 兜底,只有真缺模块时才会被 import)
RUN set -eux && mkdir -p /opt/shims/ixformer/contrib/vllm/layers && for d in /opt/shims/ixformer /opt/shims/ixformer/contrib /opt/shims/ixformer/contrib/vllm /opt/shims/ixformer/contrib/vllm/layers; do printf '# ModelHub XC compat shim package\n' > "$d/__init__.py"; done && cp /opt/shims_src/shims_ixformer_layers.py /opt/shims/ixformer/contrib/vllm/layers/__init__.py && rm -rf /opt/shims_src && chmod +x /opt/vllm_wrapper.sh /opt/preflight.py && python3 -c "import ast,io;[ast.parse(io.open(f,encoding='utf-8').read()) for f in ['/opt/preflight.py','/opt/detect_tokenizer.py','/opt/shims/ixformer/contrib/vllm/layers/__init__.py']]" && bash -n /opt/vllm_wrapper.sh && echo "[enginex-bi100-compat] preflight syntax OK"
# R7:让 shims 全局可 import
ENV PYTHONPATH=/opt/shims:${PYTHONPATH}
ENV MODEL_DIR=/model
# 关键一步:把 vllm 二进制换成 wrapper(真身改名 vllm_real),
# 平台下发的 `vllm serve ...` 因此流经本引擎的启动前修补。
RUN set -eux && VLLM_BIN="$(command -v vllm || echo /usr/local/corex/lib64/python3/dist-packages/bin/vllm)" && \
if [ ! -f "$VLLM_BIN" ]; then echo "vllm binary not found at $VLLM_BIN"; exit 1; fi && \
mv "$VLLM_BIN" "${VLLM_BIN}_real" && \
ln -s /opt/vllm_wrapper.sh "$VLLM_BIN" && \
echo "[enginex-bi100-compat] vllm -> wrapper installed"