feat: move torch and transformers to local group (#1172)

This commit is contained in:
Pablo Orgaz 2023-11-06 14:24:16 +01:00 committed by GitHub
parent ad512e3c42
commit 0d677e10b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 566 additions and 560 deletions

View File

@ -39,6 +39,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.external
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

36
Dockerfile.external Normal file
View File

@ -0,0 +1,36 @@
FROM python:3.11.6-slim-bookworm as base
# Install poetry
RUN pip install pipx
RUN python3 -m pipx ensurepath
RUN pipx install poetry
ENV PATH="/root/.local/bin:$PATH"
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
FROM base as dependencies
WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./
RUN poetry install --with ui
FROM base as app
ENV PYTHONUNBUFFERED=1
ENV PORT=8080
EXPOSE 8080
# Prepare a non-root user
RUN adduser --system worker
WORKDIR /home/worker/app
RUN mkdir local_data; chown worker local_data
RUN mkdir models; chown worker models
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
COPY --chown=worker private_gpt/ private_gpt
COPY --chown=worker docs/ docs
COPY --chown=worker *.yaml *.md ./
USER worker
ENTRYPOINT .venv/bin/python -m private_gpt

View File

@ -8,7 +8,7 @@ RUN python3 -m pipx ensurepath
RUN pipx install poetry
ENV PATH="/root/.local/bin:$PATH"
# Dependencies to build llama-cpp and wget
# Dependencies to build llama-cpp
RUN apt update && apt install -y \
libopenblas-dev\
ninja-build\
@ -23,13 +23,13 @@ FROM base as dependencies
WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./
RUN poetry install --with local
RUN poetry install --with ui
FROM base as app
ENV PYTHONUNBUFFERED=1
ENV PORT=8080
ENV PGPT_PROFILES=docker
EXPOSE 8080
# Prepare a non-root user

1075
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,6 @@ pypdf = "^3.16.2"
llama-index = "0.8.47"
chromadb = "^0.4.13"
watchdog = "^3.0.0"
transformers = "^4.34.0"
# https://stackoverflow.com/questions/76327419/valueerror-libcublas-so-0-9-not-found-in-the-system-path
torch = ">=2.0.0, !=2.0.1, !=2.1.0"
[tool.poetry.group.dev.dependencies]
black = "^22"
@ -38,9 +35,12 @@ gradio = "^3.45.2"
[tool.poetry.group.local]
optional = true
[tool.poetry.group.local.dependencies]
sentence-transformers = "^2.2.2"
numpy = "1.26.0"
llama-cpp-python = "^0.2.11"
numpy = "1.26.0"
sentence-transformers = "^2.2.2"
# https://stackoverflow.com/questions/76327419/valueerror-libcublas-so-0-9-not-found-in-the-system-path
torch = ">=2.0.0, !=2.0.1, !=2.1.0"
transformers = "^4.34.0"
[build-system]
requires = ["poetry-core>=1.0.0"]