Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/infinity_emb/Dockerfile.amd_auto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libs/infinity_emb/Dockerfile.cpu_auto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines 57 to +58

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: TODO comment indicates this line should be removed, but it's being modified instead. Consider removing the line entirely or removing the TODO if the line is now permanent.


FROM builder AS testing
# install lint and test dependencies
Expand Down
2 changes: 1 addition & 1 deletion libs/infinity_emb/Dockerfile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines 47 to +48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: consider using poetry to manage these dependencies instead of direct pip install to maintain consistent dependency management


FROM builder AS testing
# install lint and test dependencies
Expand Down
2 changes: 1 addition & 1 deletion libs/infinity_emb/Dockerfile.nvidia_auto
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: flash-attention wheel is pinned to Python 3.10 and CUDA 12, but there's no explicit Python version check

Suggested change
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
RUN if [ "$($PYTHON --version 2>&1)" != "Python 3.10"* ]; then echo "Error: Python 3.10 is required for flash-attention wheel" && exit 1; fi && \
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
Expand Down
2 changes: 1 addition & 1 deletion libs/infinity_emb/Dockerfile.trt_onnx_auto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 16 additions & 7 deletions libs/infinity_emb/infinity_emb/transformer/vision/torch_vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down