diff --git a/compose/local/django/Dockerfile.llama b/compose/local/django/Dockerfile.llama deleted file mode 100755 index 7719a34..0000000 --- a/compose/local/django/Dockerfile.llama +++ /dev/null @@ -1,110 +0,0 @@ -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}" - -# Actualizar pip, setuptools y wheel antes de instalar dependencias -RUN python -m pip install --upgrade pip setuptools wheel - -# 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 \ - -r extra-llama.txt - -# Python 'run' stage -FROM python AS python-run-stage - -ARG BUILD_ENVIRONMENT=local -ARG APP_HOME=/app - -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 -ENV BUILD_ENV ${BUILD_ENVIRONMENT} - -WORKDIR ${APP_HOME} - -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 \ - # Translations dependencies - gettext \ - # 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 \ - # 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 -RUN pip install --no-cache-dir --no-index --find-links=/wheels/ $(find /wheels/ -name "*.whl") \ - && rm -rf /wheels/ - -COPY ./compose/production/django/entrypoint /entrypoint -RUN sed -i 's/\r$//g' /entrypoint -RUN chmod +x /entrypoint - -COPY ./compose/local/django/start /start -RUN sed -i 's/\r$//g' /start -RUN chmod +x /start - -COPY ./compose/local/django/celery/worker/start /start-celeryworker -RUN sed -i 's/\r$//g' /start-celeryworker -RUN chmod +x /start-celeryworker - -COPY ./compose/local/django/celery/beat/start /start-celerybeat -RUN sed -i 's/\r$//g' /start-celerybeat -RUN chmod +x /start-celerybeat - -COPY ./compose/local/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 . ${APP_HOME} - -ENTRYPOINT ["/entrypoint"] diff --git a/config/settings/base.py b/config/settings/base.py index 59ec47e..086efc2 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -299,7 +299,7 @@ } # LLAMA -LLAMA_ENABLED = env.bool("LLAMA_ENABLED", default=False) +LLAMA_ENABLED = env.bool("LLAMA_ENABLED", default=True) MODEL_LLAMA = "llama-3.2-3b-instruct-q4_k_m.gguf" #Aumento en el límite de campos diff --git a/fixtures/Artigo 5.docx b/fixtures/Artigo 5.docx new file mode 100644 index 0000000..5fbf592 Binary files /dev/null and b/fixtures/Artigo 5.docx differ diff --git a/fixtures/e14790.docx b/fixtures/e14790.docx new file mode 100644 index 0000000..36bb9d0 Binary files /dev/null and b/fixtures/e14790.docx differ diff --git a/fixtures/e740.docx b/fixtures/e740.docx new file mode 100644 index 0000000..25240d4 Binary files /dev/null and b/fixtures/e740.docx differ diff --git a/llama.local.yml b/llama.local.yml deleted file mode 100644 index 6af50cb..0000000 --- a/llama.local.yml +++ /dev/null @@ -1,77 +0,0 @@ -services: - django: &django - build: - context: . - dockerfile: ./compose/local/django/Dockerfile.llama - args: - BUILD_ENVIRONMENT: local - image: markapi_local_django - container_name: markapi_local_django - depends_on: - - redis - - postgres - - mailhog - volumes: - - .:/app:z - env_file: - - ./.envs/.local/.django - - ./.envs/.local/.postgres - ports: - - "8009:8000" - command: /start - - mailhog: - image: mailhog/mailhog:v1.0.0 - container_name: markapi_local_mailhog - ports: - - "8029:8025" - - postgres: - build: - context: . - dockerfile: ./compose/production/postgres/Dockerfile - image: markapi_local_postgres - container_name: markapi_local_postgres - volumes: - - ../scms_data/markapi/data_dev:/var/lib/postgresql/data:Z - - ../scms_data/markapi/data_dev_backup:/backups:z - ports: - - "5439:5432" - env_file: - - ./.envs/.local/.postgres - - redis: - image: redis:6 - container_name: markapi_local_redis - ports: - - "6399:6379" - - celeryworker: - <<: *django - image: markapi_local_celeryworker - container_name: markapi_local_celeryworker - depends_on: - - redis - - postgres - - mailhog - ports: [] - command: /start-celeryworker - - celerybeat: - <<: *django - image: markapi_local_celerybeat - container_name: markapi_local_celerybeat - depends_on: - - redis - - postgres - - mailhog - ports: [] - command: /start-celerybeat - - flower: - <<: *django - image: markapi_local_flower - container_name: markapi_local_flower - ports: - - "5559:5555" - command: /start-flower diff --git a/reference/models.py b/reference/models.py index 684a045..404c9e5 100755 --- a/reference/models.py +++ b/reference/models.py @@ -21,7 +21,7 @@ class ReferenceStatus(models.IntegerChoices): class Reference(CommonControlField, ClusterableModel): mixed_citation = models.TextField(_("Mixed Citation"), null=False, blank=True) - status = models.IntegerField( + estatus = models.IntegerField( _("Reference status"), choices=ReferenceStatus.choices, blank=True, diff --git a/reference/wagtail_hooks.py b/reference/wagtail_hooks.py index 09b9928..564dce3 100644 --- a/reference/wagtail_hooks.py +++ b/reference/wagtail_hooks.py @@ -25,7 +25,7 @@ def form_valid(self, form): if linea: # Evitar procesar líneas vacías new_reference = Reference.objects.create( mixed_citation=linea, - status=1, # Estatus predeterminado + estatus=1, # Estatus predeterminado creator=self.request.user, # Usuario asociado ) get_reference.delay(new_reference.id) diff --git a/requirements/base.txt b/requirements/base.txt index f8be424..ae76283 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -50,4 +50,13 @@ google-generativeai==0.3.2 # Docx # ------------------------------------------------------------------------------ -python-docx==1.1.2 \ No newline at end of file +python-docx==1.1.2 + +# huggingface-hub +# ------------------------------------------------------------------------------ +huggingface_hub==0.26.1 # https://pypi.org/project/huggingface-hub/ + +# Python Bindings for llama.cpp +# ------------------------------------------------------------------------------ +llama-cpp-python==0.3.14 # https://llama-cpp-python.readthedocs.io/en/latest/ + diff --git a/requirements/extra-llama.txt b/requirements/extra-llama.txt deleted file mode 100644 index c949747..0000000 --- a/requirements/extra-llama.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Llama -# ------------------------------------------------------------------------------ -huggingface-hub==0.26.1 -llama-cpp-python==0.3.14