|
|
|
|
|
FROM vllm/vllm-openai:v0.9.1 |
|
|
|
|
|
|
|
|
USER root |
|
|
|
|
|
|
|
|
ENV HF_HUB_ENABLE_HF_TRANSFER=1 \ |
|
|
GIT_LFS_SKIP_SMUDGE=1 \ |
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 |
|
|
|
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir "transformers>=4.51.1" "huggingface_hub>=0.24.0" |
|
|
|
|
|
|
|
|
|
|
|
ARG MODEL_ID=rednote-hilab/dots.ocr |
|
|
RUN python3 - <<'PY' |
|
|
from huggingface_hub import snapshot_download |
|
|
import os, shutil |
|
|
root = "/weights" |
|
|
os.makedirs(root, exist_ok=True) |
|
|
|
|
|
tmp = snapshot_download(repo_id=os.environ.get("MODEL_ID","rednote-hilab/dots.ocr"), |
|
|
local_dir=os.path.join(root,"_tmp"), allow_patterns=["*"]) |
|
|
dst = os.path.join(root,"DotsOCR") |
|
|
os.makedirs(dst, exist_ok=True) |
|
|
for name in os.listdir(tmp): |
|
|
if name == "DotsOCR": continue |
|
|
shutil.move(os.path.join(tmp,name), os.path.join(dst,name)) |
|
|
shutil.rmtree(tmp, ignore_errors=True) |
|
|
PY |
|
|
|
|
|
|
|
|
ENV HF_MODEL_PATH=/weights/DotsOCR |
|
|
ENV PYTHONPATH="/weights:${PYTHONPATH}" |
|
|
|
|
|
|
|
|
|
|
|
RUN sed -i '/^from vllm\.entrypoints\.cli\.main import main$/a\ |
|
|
from DotsOCR import modeling_dots_ocr_vllm' $(which vllm) |
|
|
|
|
|
|
|
|
EXPOSE 7860 |
|
|
ENV PORT=7860 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CMD bash -lc '\ |
|
|
vllm serve ${HF_MODEL_PATH} \ |
|
|
--host 0.0.0.0 --port ${PORT} \ |
|
|
--served-model-name model \ |
|
|
--gpu-memory-utilization 0.95 \ |
|
|
--chat-template-content-format string \ |
|
|
--trust-remote-code \ |
|
|
' |
|
|
|