From e678b8589f7f8af340335ea8c4b7a5228a93eb40 Mon Sep 17 00:00:00 2001 From: michaelfeil <63565275+michaelfeil@users.noreply.github.com> Date: Thu, 17 Apr 2025 17:22:58 +0000 Subject: [PATCH 1/2] docker image overwrite --- libs/infinity_emb/Dockerfile.amd_auto | 2 +- libs/infinity_emb/Dockerfile.cpu_auto | 2 +- libs/infinity_emb/Dockerfile.jinja2 | 2 +- libs/infinity_emb/Dockerfile.nvidia_auto | 2 +- libs/infinity_emb/Dockerfile.trt_onnx_auto | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/infinity_emb/Dockerfile.amd_auto b/libs/infinity_emb/Dockerfile.amd_auto index 57e90a4c..5f6651e7 100644 --- a/libs/infinity_emb/Dockerfile.amd_auto +++ b/libs/infinity_emb/Dockerfile.amd_auto @@ -88,7 +88,7 @@ else \ fi # TODO: remove this line -RUN apt-get install --no-install-recommends -y git && poetry run python -m pip install git+https://github.com/huggingface/transformers.git@7547f55e5d93245c0a013b50df976924f2d9e8b0 && rm -rf ~/.cache/ /tmp/* +RUN poetry run pip install --no-cache-dir transformers==4.50.3 colpali-engine==0.3.9 FROM builder AS testing # install lint and test dependencies diff --git a/libs/infinity_emb/Dockerfile.cpu_auto b/libs/infinity_emb/Dockerfile.cpu_auto index 94ea0202..5792f78a 100644 --- a/libs/infinity_emb/Dockerfile.cpu_auto +++ b/libs/infinity_emb/Dockerfile.cpu_auto @@ -55,7 +55,7 @@ RUN poetry run python -m pip install --no-cache-dir onnxruntime-openvino # # TODO: remove this line -RUN apt-get install --no-install-recommends -y git && poetry run python -m pip install git+https://github.com/huggingface/transformers.git@7547f55e5d93245c0a013b50df976924f2d9e8b0 && rm -rf ~/.cache/ /tmp/* +RUN poetry run pip install --no-cache-dir transformers==4.50.3 colpali-engine==0.3.9 FROM builder AS testing # install lint and test dependencies diff --git a/libs/infinity_emb/Dockerfile.jinja2 b/libs/infinity_emb/Dockerfile.jinja2 index b7575487..5c55e390 100644 --- a/libs/infinity_emb/Dockerfile.jinja2 +++ b/libs/infinity_emb/Dockerfile.jinja2 @@ -45,7 +45,7 @@ COPY infinity_emb infinity_emb {{main_install|replace("--no-root","")}} {{extra_installs_main | default('#')}} # TODO: remove this line -RUN apt-get install --no-install-recommends -y git && poetry run python -m pip install git+https://github.com/huggingface/transformers.git@7547f55e5d93245c0a013b50df976924f2d9e8b0 && rm -rf ~/.cache/ /tmp/* +RUN poetry run pip install --no-cache-dir transformers==4.50.3 colpali-engine==0.3.9 FROM builder AS testing # install lint and test dependencies diff --git a/libs/infinity_emb/Dockerfile.nvidia_auto b/libs/infinity_emb/Dockerfile.nvidia_auto index a460f044..8d16a18f 100644 --- a/libs/infinity_emb/Dockerfile.nvidia_auto +++ b/libs/infinity_emb/Dockerfile.nvidia_auto @@ -47,7 +47,7 @@ RUN poetry install --no-interaction --no-ansi --extras "${EXTRAS}" --without li RUN poetry run $PYTHON -m pip install --no-cache-dir https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl # TODO: remove this line -RUN apt-get install --no-install-recommends -y git && poetry run python -m pip install git+https://github.com/huggingface/transformers.git@7547f55e5d93245c0a013b50df976924f2d9e8b0 && rm -rf ~/.cache/ /tmp/* +RUN poetry run pip install --no-cache-dir transformers==4.50.3 colpali-engine==0.3.9 FROM builder AS testing # install lint and test dependencies diff --git a/libs/infinity_emb/Dockerfile.trt_onnx_auto b/libs/infinity_emb/Dockerfile.trt_onnx_auto index 4f2154b6..214e65f5 100644 --- a/libs/infinity_emb/Dockerfile.trt_onnx_auto +++ b/libs/infinity_emb/Dockerfile.trt_onnx_auto @@ -52,7 +52,7 @@ RUN poetry run $PYTHON -m pip install --no-cache-dir flash-attn --no-build-isola RUN poetry run $PYTHON -m pip install --no-cache-dir "tensorrt==10.3.0" "tensorrt_lean==10.3.0" "tensorrt_dispatch==10.3.0" # TODO: remove this line -RUN apt-get install --no-install-recommends -y git && poetry run python -m pip install git+https://github.com/huggingface/transformers.git@7547f55e5d93245c0a013b50df976924f2d9e8b0 && rm -rf ~/.cache/ /tmp/* +RUN poetry run pip install --no-cache-dir transformers==4.50.3 colpali-engine==0.3.9 FROM builder AS testing # install lint and test dependencies From 31f7eefa20ef87186309b3c984fff2cb371ba3b3 Mon Sep 17 00:00:00 2001 From: michaelfeil <63565275+michaelfeil@users.noreply.github.com> Date: Thu, 17 Apr 2025 17:27:42 +0000 Subject: [PATCH 2/2] docker image overwrite --- .../transformer/vision/torch_vision.py | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libs/infinity_emb/infinity_emb/transformer/vision/torch_vision.py b/libs/infinity_emb/infinity_emb/transformer/vision/torch_vision.py index 98f43c4e..7099f0fa 100644 --- a/libs/infinity_emb/infinity_emb/transformer/vision/torch_vision.py +++ b/libs/infinity_emb/infinity_emb/transformer/vision/torch_vision.py @@ -66,23 +66,32 @@ def __init__(self, *, engine_args: "EngineArgs"): ColPaliProcessor, ColQwen2, ColQwen2Processor, - # TODO: colqwen 2.5 is not supported with colpali-engine 0.3.8 - # ColQwen2_5, - # ColQwen2_5_Processor, ) - model_cls = { + model_cls_d = { "ColPali": ColPali, "ColQwen2": ColQwen2, # "ColQwen2_5": ColQwen2_5, "ColIdefics2": ColIdefics2, - }[config.architectures[0]] - processor_cls = { + } + processor_cls_d = { "ColPali": ColPaliProcessor, "ColQwen2": ColQwen2Processor, # "ColQwen2_5": ColQwen2_5_Processor, "ColIdefics2": ColIdefics2Processor, - }[config.architectures[0]] + } + try: + # TODO: colqwen 2.5 is not supported with colpali-engine 0.3.8 + from colpali_engine.models import ColQwen2_5 # type: ignore + from colpali_engine.models import ColQwen2_5_Processor # type: ignore + + model_cls_d["ColQwen2_5"] = ColQwen2_5 + processor_cls_d["ColQwen2_5"] = ColQwen2_5_Processor + except ImportError: + pass + + model_cls = model_cls_d[config.architectures[0]] + processor_cls = processor_cls_d[config.architectures[0]] self.model = model_cls.from_pretrained( **extra_model_args,