-
Notifications
You must be signed in to change notification settings - Fork 5
Cria capacidade de usar sistema com ou sem suporte ao LLaMa #28
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
Changes from all commits
4c98845
7fcb03e
050297e
b0f1a31
a32aadf
a4161d8
5de0daf
71c0a4b
f5caf9f
648760b
6865310
51dd32e
2b00c39
67d1f70
78a42aa
ca0819e
3302460
7e3a713
524d97e
b51c734
beb0036
1509008
c9e2681
2a57bed
975045b
77d3aa3
cb2021a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,110 @@ | ||||||
| ARG PYTHON_VERSION=3.11-bullseye | ||||||
|
|
||||||
| # define an alias for the specfic python version used in this file. | ||||||
| FROM python:${PYTHON_VERSION} AS python | ||||||
|
|
||||||
| # Python build stage | ||||||
| FROM python AS python-build-stage | ||||||
|
|
||||||
| ARG BUILD_ENVIRONMENT=local | ||||||
|
|
||||||
| # Install apt packages | ||||||
| RUN apt-get update && apt-get install --no-install-recommends -y \ | ||||||
| # dependencies for building Python packages | ||||||
| build-essential \ | ||||||
| git \ | ||||||
| # psycopg2 dependencies | ||||||
| libpq-dev \ | ||||||
| # other dependencies | ||||||
| software-properties-common \ | ||||||
| libopenblas-dev \ | ||||||
| libomp-dev | ||||||
|
|
||||||
| # Instalar gcc-10 y g++-10 en Debian Bullseye | ||||||
| RUN apt-get update && \ | ||||||
| apt-get install -y gcc-10 g++-10 ninja-build cmake && \ | ||||||
| update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 50 && \ | ||||||
| update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 50 && \ | ||||||
| apt-get clean && rm -rf /var/lib/apt/lists/* | ||||||
|
|
||||||
| # Configurar variables de entorno para compilar con BLAS y SIMD condicionalmente | ||||||
| ARG ENABLE_OPTIMIZATIONS=true | ||||||
| ENV CFLAGS="${ENABLE_OPTIMIZATIONS:+-mfma -mavx2}" \ | ||||||
| CXXFLAGS="${ENABLE_OPTIMIZATIONS:+-mfma -mavx2}" \ | ||||||
| CMAKE_ARGS="${ENABLE_OPTIMIZATIONS:+-DGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS}" | ||||||
|
||||||
| CMAKE_ARGS="${ENABLE_OPTIMIZATIONS:+-DGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS}" | |
| LLAMA_CMAKE_ARGS="${ENABLE_OPTIMIZATIONS:+-DGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS}" |
Copilot
AI
Oct 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment should be in English to maintain consistency with the rest of the codebase.
| # Actualizar pip, setuptools y wheel antes de instalar dependencias | |
| # Update pip, setuptools, and wheel before installing dependencies |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| ARG PYTHON_VERSION=3.11-bullseye | ||
|
|
||
| # define an alias for the specfic python version used in this file. | ||
| FROM python:${PYTHON_VERSION} as python | ||
|
|
||
| # Python build stage | ||
| FROM python as python-build-stage | ||
|
|
||
| ARG BUILD_ENVIRONMENT=production | ||
|
|
||
| # Install apt packages | ||
| RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
| # dependencies for building Python packages | ||
| git \ | ||
| build-essential \ | ||
| # psycopg2 dependencies | ||
| libpq-dev | ||
|
|
||
| # Requirements are installed here to ensure they will be cached. | ||
| COPY ./requirements . | ||
|
|
||
| # Create application directory to hold DOCX layouts | ||
| COPY ./docx_layouts . | ||
|
|
||
| # Update pip | ||
| RUN python -m pip install --upgrade pip | ||
|
|
||
| # Create Python Dependency and Sub-Dependency Wheels. | ||
| RUN pip wheel --wheel-dir /usr/src/app/wheels \ | ||
| -r ${BUILD_ENVIRONMENT}.txt | ||
|
|
||
| # Python 'run' stage | ||
| FROM python as python-run-stage | ||
|
|
||
| ARG BUILD_ENVIRONMENT=production | ||
| ARG APP_HOME=/app | ||
|
|
||
| ENV PYTHONUNBUFFERED 1 | ||
| ENV PYTHONDONTWRITEBYTECODE 1 | ||
| ENV BUILD_ENV ${BUILD_ENVIRONMENT} | ||
|
|
||
| # Install llama-cpp-python with specific CMAKE flags for Kubernetes nodes without AVX support | ||
| ARG DISABLE_AVX=true | ||
|
|
||
| # Set the version of llama-cpp-python | ||
| ARG LLAMA_VERSION=0.3.14 | ||
|
|
||
| WORKDIR ${APP_HOME} | ||
|
|
||
| RUN addgroup --system django \ | ||
| && adduser --system --ingroup django django | ||
|
|
||
| RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list | ||
|
|
||
| # Install required system dependencies | ||
| RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
| # psycopg2 dependencies | ||
| libpq-dev \ | ||
| # libreoffice for document conversions | ||
| default-jre libreoffice libreoffice-java-common ttf-mscorefonts-installer fonts-liberation fonts-liberation2 fonts-crosextra-carlito fonts-crosextra-caladea fonts-dejavu fonts-noto \ | ||
| # Translations dependencies | ||
| gettext \ | ||
| # cleaning up unused files | ||
| && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction | ||
| # copy python dependency wheels from python-build-stage | ||
| COPY --from=python-build-stage /usr/src/app/wheels /wheels/ | ||
|
|
||
| # use wheels to install python dependencies (excluding llama-cpp-python) | ||
| RUN pip install --no-cache-dir --no-index --find-links=/wheels/ $(find /wheels/ -name "*.whl" ! -name "llama_cpp_python*") && rm -rf /wheels/ | ||
|
|
||
| # Install llama-cpp-python with specific CMAKE flags for Kubernetes nodes without AVX support | ||
| RUN if [ "${DISABLE_AVX}" = "true" ]; then \ | ||
| CMAKE_ARGS='-DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF -DLLAMA_OPENMP=ON' pip install llama-cpp-python==${LLAMA_VERSION} --force-reinstall --no-cache-dir; \ | ||
| else \ | ||
| pip install llama-cpp-python==${LLAMA_VERSION} --force-reinstall --no-cache-dir; \ | ||
| fi | ||
|
|
||
| COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint | ||
| RUN sed -i 's/\r$//g' /entrypoint | ||
| RUN chmod +x /entrypoint | ||
|
|
||
| COPY --chown=django:django ./compose/production/django/start /start | ||
| RUN sed -i 's/\r$//g' /start | ||
| RUN chmod +x /start | ||
|
|
||
| COPY --chown=django:django ./compose/production/django/celery/worker/start /start-celeryworker | ||
| RUN sed -i 's/\r$//g' /start-celeryworker | ||
| RUN chmod +x /start-celeryworker | ||
|
|
||
| COPY --chown=django:django ./compose/production/django/celery/beat/start /start-celerybeat | ||
| RUN sed -i 's/\r$//g' /start-celerybeat | ||
| RUN chmod +x /start-celerybeat | ||
|
|
||
| COPY ./compose/production/django/celery/flower/start /start-flower | ||
| RUN sed -i 's/\r$//g' /start-flower | ||
| RUN chmod +x /start-flower | ||
|
|
||
| # copy application code to WORKDIR | ||
| COPY --chown=django:django . ${APP_HOME} | ||
|
|
||
| # make django owner of the WORKDIR directory as well. | ||
| RUN chown django:django ${APP_HOME} | ||
|
|
||
| USER django | ||
|
|
||
| ENTRYPOINT ["/entrypoint"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment should be in English to maintain consistency with the rest of the codebase.