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 .tekton/own-app-lightspeed-rag-content-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ spec:
- pipelineTaskName: prefetch-dependencies
computeResources:
limits:
memory: 8Gi
memory: 12Gi
taskRunTemplate:
serviceAccountName: build-pipeline-own-app-lightspeed-rag-content
timeouts:
Expand Down
2 changes: 1 addition & 1 deletion .tekton/own-app-lightspeed-rag-content-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ spec:
- pipelineTaskName: prefetch-dependencies
computeResources:
limits:
memory: 8Gi
memory: 12Gi
taskRunTemplate:
serviceAccountName: build-pipeline-own-app-lightspeed-rag-content
timeouts:
Expand Down
17 changes: 8 additions & 9 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ ARG EMBEDDING_MODEL=sentence-transformers/all-mpnet-base-v2
ARG FLAVOR=cpu
ARG HERMETIC=false

FROM registry.access.redhat.com/ubi9/python-311 as cpu-base
FROM registry.access.redhat.com/ubi9/python-312 as cpu-base
ARG EMBEDDING_MODEL
ARG FLAVOR

FROM nvcr.io/nvidia/cuda:12.9.1-devel-ubi9 as gpu-base
FROM registry.redhat.io/rhai/base-image-cuda-12.9-rhel9:3.3 as gpu-base
ARG EMBEDDING_MODEL
ARG FLAVOR
RUN dnf install -y python3.11 python3.11-pip libcudnn9 libnccl libcusparselt0
USER 0
RUN dnf install -y python3.12 python3.12-pip libcudnn9 libnccl libcusparselt0

FROM ${FLAVOR}-base as lightspeed-rag-builder
ARG EMBEDDING_MODEL
Expand All @@ -20,7 +21,7 @@ USER 0
WORKDIR /workdir

COPY requirements.gpu.txt .
RUN pip3.11 install --no-cache-dir -r requirements.gpu.txt && ln -s /usr/local/lib/python3.11/site-packages/llama_index/core/_static/nltk_cache /root/nltk_data
RUN pip3.12 install --no-cache-dir -r requirements.gpu.txt && ln -s /usr/local/lib/python3.12/site-packages/llama_index/core/_static/nltk_cache /root/nltk_data

COPY ocp-product-docs-plaintext ./ocp-product-docs-plaintext
COPY runbooks ./runbooks
Expand All @@ -33,14 +34,12 @@ RUN cd embeddings_model; if [ "$HERMETIC" == "true" ]; then \
fi

RUN if [ "$FLAVOR" == "gpu" ]; then \
export LD_LIBRARY_PATH=/usr/local/cuda-12/compat:$LD_LIBRARY_PATH; \
python3.11 -c "import torch; print(torch.version.cuda); print(torch.cuda.is_available());"; \
python3.12 -c "import torch; print(torch.version.cuda); print(torch.cuda.is_available());"; \
fi

COPY scripts/generate_embeddings.py .
RUN export LD_LIBRARY_PATH=/usr/local/cuda-12/compat:$LD_LIBRARY_PATH; \
set -e && for OCP_VERSION in $(ls -1 ocp-product-docs-plaintext); do \
python3.11 generate_embeddings.py -f ocp-product-docs-plaintext/${OCP_VERSION} -r runbooks/alerts -md embeddings_model \
RUN set -e && for OCP_VERSION in $(ls -1 ocp-product-docs-plaintext); do \
python3.12 generate_embeddings.py -f ocp-product-docs-plaintext/${OCP_VERSION} -r runbooks/alerts -md embeddings_model \
-mn ${EMBEDDING_MODEL} -o vector_db/ocp_product_docs/${OCP_VERSION} \
-i ocp-product-docs-$(echo $OCP_VERSION | sed 's/\./_/g') -v ${OCP_VERSION} -hb $HERMETIC; \
done
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $(error Unsupported FLAVOR $(FLAVOR), must be 'cpu' or 'gpu')
endif

install-tools: ## Install required utilities/tools
@command -v pdm > /dev/null || { echo >&2 "pdm is not installed. Installing..."; pip3.11 install --no-cache-dir --upgrade pip pdm; }
@command -v pdm > /dev/null || { echo >&2 "pdm is not installed. Installing..."; pip3.12 install --no-cache-dir --upgrade pip pdm; }

pdm-lock-check: ## Check that the pdm.lock file is in a good shape
pdm lock --check --group cpu --lockfile pdm.lock.cpu
Expand Down
2 changes: 1 addition & 1 deletion byok/Containerfile.output
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ USER 0
WORKDIR /workdir

ENV VECTOR_DB_INDEX=$VECTOR_DB_INDEX
RUN python3.11 generate_embeddings_tool.py -i /markdown -emd embeddings_model \
RUN python3.12 generate_embeddings_tool.py -i /markdown -emd embeddings_model \
-emn sentence-transformers/all-mpnet-base-v2 -o vector_db -id $VECTOR_DB_INDEX

FROM ${UBI_BASE_IMAGE}
Expand Down
8 changes: 4 additions & 4 deletions byok/Containerfile.tool
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BYOK_TOOL_IMAGE=registry.redhat.io/openshift-lightspeed-tech-preview/lightspeed-rag-tool-rhel9:latest
ARG UBI_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:latest
ARG UBI_BASE_IMAGE=registry.redhat.io/rhai/base-image-cpu-rhel9:3.3
ARG HERMETIC=false
FROM ${UBI_BASE_IMAGE}
ARG LOG_LEVEL=info
Expand All @@ -8,13 +8,13 @@ ARG VECTOR_DB_INDEX=vector_db_index
ARG BYOK_TOOL_IMAGE
ARG UBI_BASE_IMAGE
ARG HERMETIC
RUN dnf install -y buildah python3.11 python3.11-pip && dnf clean all

USER 0
RUN dnf install -y buildah python3.12 python3.12-pip && dnf clean all

WORKDIR /workdir

COPY requirements.cpu.txt .
RUN pip3.11 install --no-cache-dir --no-deps -r requirements.cpu.txt
RUN pip3.12 install --no-cache-dir --no-deps -r requirements.cpu.txt

COPY embeddings_model ./embeddings_model
ENV HERMETIC=$HERMETIC
Expand Down
697 changes: 345 additions & 352 deletions pdm.lock.cpu

Large diffs are not rendered by default.

849 changes: 430 additions & 419 deletions pdm.lock.gpu

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ lint.extend-select = ["D401"]

lint.ignore = []

target-version = "py311"
target-version = "py312"
lint.pydocstyle.convention = "google"
line-length = 100

Expand All @@ -33,10 +33,10 @@ build-backend = "pdm.backend"

[project.optional-dependencies]
cpu = [
"torch @ https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5b6ae523bfb67088a17ca7734d131548a2e60346c622621e4248ed09dd0790cc",
"torch @ https://packages.redhat.com/api/pulp-content/public-rhai/rhoai/3.3/cpu-ubi9/torch-2.9.1-4-cp312-cp312-linux_x86_64.whl#sha256=e42ab849b64444059f5eda352d61c9c3a078f30797e48e2972857182c9a00cf8",
]
gpu = [
"torch==2.6.0",
"torch==2.9.1",
]

[project]
Expand All @@ -58,6 +58,6 @@ dependencies = [
"beautifulsoup4>=4.10.0",
"urllib3>=2.6.3",
]
requires-python = "==3.11.*"
requires-python = "==3.12.*"
readme = "README.md"
license = {file = "LICENSE"}
Loading