Skip to content

Commit

Permalink
review docker run command
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Aug 25, 2023
1 parent d12d6a2 commit 707030a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions doc/Grobid-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,25 @@ Current latest version:
- Run the container:

```bash
> docker run --rm --gpus --init all -p 8070:8070 grobid/grobid:0.7.3
> docker run --rm --gpus all --init --ulimit core=0 -p 8070:8070 grobid/grobid:0.7.3
```

The image will automatically uses the GPU and CUDA version available on your host machine, but only on Linux. GPU usage via a container on Windows and MacOS machine is currently not supported by Docker. If no GPU are available, CPU will be used.
The image will automatically uses the GPU and CUDA version available on your host machine, but only on Linux. GPU usage via a container on Windows and MacOS machine is currently not supported by Docker. If no GPU are available, CPU will be used.

Note that starting the container with option `--ulimit core=0` avoids having possible core dumped inside the container, which can happen overwise due to the crash of the PDF parsing C++ component.

To specify to use only certain GPUs (see the [nvidia container toolkit user guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html#gpu-enumeration) for more details):

```bash
> docker run --rm --gpus '"device=1,2"' --init -p 8070:8070 -p 8081:8071 grobid/grobid:${latest_grobid_version}
> docker run --rm --gpus '"device=1,2"' --init --ulimit core=0 -p 8070:8070 -p 8081:8071 grobid/grobid:${latest_grobid_version}
```

You can run the image on CPU by omitting the `-gpus` parameters.

Note the default version is running on port `8070`, however it can be mapped on the more traditional port `8080` of your host with the following command:

```bash
> docker run -t --rm --gpus all --init -p 8080:8070 grobid/grobid:${latest_grobid_version}
> docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 grobid/grobid:${latest_grobid_version}
```

Access the service:
Expand Down Expand Up @@ -90,19 +92,19 @@ Latest version:
- Run the container:

```bash
> docker run -t --rm --init -p 8070:8070 lfoppiano/grobid:${latest_grobid_version}
> docker run --rm --init --ulimit core=0 -p 8070:8070 lfoppiano/grobid:${latest_grobid_version}
```

Latest version:

```bash
> docker run -t --rm --init -p 8070:8070 lfoppiano/grobid:0.7.3
> docker run --rm --init --ulimit core=0 -p 8070:8070 lfoppiano/grobid:0.7.3
```

Note the default version is running on port `8070`, however it can be mapped on the more traditional port `8080` of your host with the following command:

```bash
> docker run -t --rm --init -p 8080:8070 -p 8081:8071 lfoppiano/grobid:${latest_grobid_version}
> docker run --rm --init --ulimit core=0 -p 8080:8070 -p 8081:8071 lfoppiano/grobid:${latest_grobid_version}
```

Access the service:
Expand All @@ -117,7 +119,7 @@ Grobid web services are then available as described in the [service documentatio
The simplest way to pass a modified configuration to the docker image is to mount the yaml GROBID config file `grobid.yaml` when running the image. Modify the config file `grobid/grobid-home/config/grobid.yaml` according to your requirements on the host machine and mount it when running the image as follow:

```bash
docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.7.3
docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.7.3
```

You need to use an absolute path to specify your modified `grobid.yaml` file.
Expand Down Expand Up @@ -230,13 +232,13 @@ docker build -t grobid/grobid:0.8.0-SNAPSHOT --build-arg GROBID_VERSION=0.8.0-SN
In order to run the container of the newly created image, for example for the development version `0.8.0-SNAPSHOT`, using all GPU available:

```bash
> docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 grobid/grobid:0.8.0-SNAPSHOT
> docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 -p 8081:8071 grobid/grobid:0.8.0-SNAPSHOT
```

In practice, you need to indicate which models should use a Deep Learning model implementation and which ones can remain with a faster CRF model implementation, which is done currently in the `grobid.yaml` file. Modify the config file `grobid/grobid-home/config/grobid.yaml` accordingly on the host machine and mount it when running the image as follow:

```bash
docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.8.0-SNAPSHOT
docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.8.0-SNAPSHOT
```

You need to use an absolute path to specify your modified `grobid.yaml` file.
Expand Down Expand Up @@ -270,7 +272,7 @@ Similarly, if you want to create a docker image from the current master, develop
In order to run the container of the newly created image, for example for version `0.7.3`:

```bash
> docker run -t --rm --init -p 8080:8070 -p 8081:8071 grobid/grobid:0.7.3
> docker run --rm --init --ulimit core=0 -p 8080:8070 -p 8081:8071 grobid/grobid:0.7.3
```

For testing or debugging purposes, you can connect to the container with a bash shell (logs are under `/opt/grobid/logs/`):
Expand Down

0 comments on commit 707030a

Please sign in to comment.