huridocs / pdf-document-layout-analysis

A Docker-powered service for PDF document layout analysis. This service provides a powerful and flexible PDF analysis service. The service allows for the segmentation and classification of different parts of PDF pages, identifying the elements such as texts, titles, pictures, tables and so on.
Apache License 2.0
94 stars 7 forks source link

Trying to create the Docker Image File results in error #48

Closed NikoolaiZim closed 1 month ago

NikoolaiZim commented 1 month ago

Since the Quickstart make start_no_gpu (executing in git bash) results in

Das System kann den angegebenen Pfad nicht finden. mkdir -p ./models Syntaxfehler. make: *** [start_no_gpu] Error 1

I´m trying to create the Docker Image using the command line docker build -t pdf-analysis .

C:\Users\<>\Desktop\Layout_Analysis\pdf-document-layout-analysis>docker build -t pdf-analysis .
[+] Building 1.6s (21/22)
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 1.02kB
=> [internal] load metadata for docker.io/pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime
=> [auth] pytorch/pytorch:pull token for registry-1.docker.io
=> [internal] load .dockerignore
=> => transferring context: 85B
=> CANCELED [ 1/17] FROM docker.io/pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime@sha256:ff97981d417f43767865c977591c29e1ce35b076398d5c5122bdca4d2a454e1b
=> => resolve docker.io/pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime@sha256:ff97981d417f43767865c977591c29e1ce35b076398d5c5122bdca4d2a454e1b
=> => sha256:ff97981d417f43767865c977591c29e1ce35b076398d5c5122bdca4d2a454e1b 1.37kB / 1.37kB
=> => sha256:ff3746dffb214cae7a04a6293ff0dfd65458adb689597615bb55630dce06758b 4.65kB / 4.65kB
=> [internal] load build context
=> => transferring context: 4.77kB
=> CACHED [ 2/17] RUN apt-get update
=> CACHED [ 3/17] RUN apt-get install -y -q --no-install-recommends libgomp1 ffmpeg libsm6 libxext6 pdftohtml git ninja-build g++
=> CACHED [ 4/17] RUN mkdir -p /app/src
=> CACHED [ 5/17] RUN mkdir -p /app/models
=> CACHED [ 6/17] RUN addgroup --system python && adduser --system --group python
=> CACHED [ 7/17] RUN chown -R python:python /app
=> CACHED [ 8/17] RUN python -m venv /app/.venv
=> CACHED [ 9/17] COPY requirements.txt requirements.txt
=> CACHED [10/17] RUN pip install --upgrade pip
=> CACHED [11/17] RUN pip --default-timeout=1000 install -r requirements.txt
=> CACHED [12/17] WORKDIR /app
=> CACHED [13/17] RUN cd src; git clone https://github.com/facebookresearch/detectron2;
=> CACHED [14/17] RUN cd src/detectron2; git checkout 70f454304e1a38378200459dd2dbca0f0f4a5ab4; python setup.py build develop
=> CACHED [15/17] COPY ./src/. ./src
=> ERROR [16/17] COPY ./models/. ./models/

=> [16/17] COPY ./models/. ./models/:

2 warnings found (use --debug to expand):

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref b5bf695f-423a-4ec6-ac4a-db54207005c6::iukyhzi5cv22ctpaakh4hd1zd: "/models": not found

Anyone got an idea of how to fix this?

Thanks and kind regards, 4Ial0kin4

NikoolaiZim commented 1 month ago

I was able to fix the ERROR Message, by manually creating the folder models in the app root folder. With this, the image will build using docker build -t pdf-analysis .

However, trying to run the image in my docker container will always immediately exit.

EDIT: The container runs as long as I download the model doclaynet_VGT_model.pth manually and add it to the Docker image manually with: docker run -it --rm -v /path/to/your/project/doclaynet_VGT_model.pth:/app/models/doclaynet_VGT_model.pth your_image_name /bin/bash as Mengqi925 mentioned in #39

ali6parmak commented 1 month ago

Hi, please try to pull the changes, we no longer use "start_no_gpu" option, we changed the endpoints. If you want to make sure you can try to remove the existing image and re-create it again.

NikoolaiZim commented 1 month ago

Hi @ali6parmak!

My repo is already up to date. Also make start will cause the error:

**The system cannot find the specified path. mkdir -p ./models Syntax error. make: *** [start] Error 1**

I´m running on windows but have make installed via choco.

ali6parmak commented 1 month ago

Hi, I just updated the Makefile. Can you pull the changes and try to run the service again?

NikoolaiZim commented 1 month ago

Thank you very much! The service is working now :)

This way I didn´t run into any issues mentioned in #39 and #40.