Skip to content

Install openvino-tokenizer python module in image #3274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 15 additions & 1 deletion Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ RUN git clone https://github.com/openvinotoolkit/openvino_tokenizers.git /openvi
WORKDIR /openvino_tokenizers/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" && cmake --build . --parallel $JOBS ; cp /openvino_tokenizers/build/src/lib*.so /opt/intel/openvino/runtime/lib/intel64/

WORKDIR /openvino_tokenizers/
# Install the openvino_tokenizers python bindings and use a symlink to point
# to the shared object in it's final location.
RUN if ! [[ $debug_bazel_flags == *"_py_off"* ]]; then \
mkdir -p /opt/intel/openvino/python/openvino_tokenizers/lib ; \
cp -r python/* /opt/intel/openvino/python/ ; \
cp build/python/* /opt/intel/openvino/python/openvino_tokenizers/ ; \
mkdir -p /opt/intel/openvino/python/openvino_tokenizers-2025.2.dist-info ; \
echo $'Metadata-Version: 1.0\nName: openvino-tokenizers\nVersion: 2025.2\nRequires-Python: >=3.9\nRequires-Dist: openvino~=2025.2.0' > /opt/intel/openvino/python/openvino_tokenizers-2025.2.dist-info/METADATA ; \
ln -s /ovms/lib/libopenvino_tokenizers.so /opt/intel/openvino/python/openvino_tokenizers/lib/libopenvino_tokenizers.so ; fi

# Build OpenVINO Model Server
WORKDIR /ovms
COPY .bazelrc .user.bazelr[c] .bazelversion WORKSPACE /ovms/
Expand Down Expand Up @@ -338,7 +349,9 @@ ARG FUZZER_BUILD=0
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"
COPY --from=capi-build /ovms_release/lib/libovms_shared.so /ovms_release/lib/
COPY create_package.sh /
RUN ./create_package.sh
RUN ./create_package.sh ; if ! [[ $debug_bazel_flags == *"_py_off"* ]]; then \
echo $'#!/bin/bash\npython3 -m openvino_tokenizers.cli "$@"' > /ovms_release/bin/convert_tokenizer ; \
chmod +x /ovms_release/bin/convert_tokenizer ; fi

# hadolint ignore=DL3059
RUN chown -R ovms:ovms /ovms_release
Expand Down Expand Up @@ -387,6 +400,7 @@ RUN if [ -f /usr/bin/dnf ] ; then export DNF_TOOL=dnf ; echo -e "max_parallel_do
useradd --home-dir /home/ovms --create-home --uid 5000 --gid 5000 --groups 39,44 --shell /bin/bash --skel /dev/null ovms

ENV LD_LIBRARY_PATH=/ovms/lib
ENV PATH="$PATH:/ovms/bin"

COPY --from=pkg /ovms_release /ovms
COPY --from=pkg /usr/local/lib/python3.*/site-packages/jinja2 /ovms/python_deps/jinja2
Expand Down