From e2b7aacf61bc0922316292732edda835b381db82 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 13 Jul 2023 16:52:08 -0700 Subject: [PATCH 1/2] install cpu torch version instead of nvidia to save space --- readme.md | 21 +++++++++++++++------ requirements/requirements.txt | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index 3e7e43c..65c3da5 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ This repository contains a computer vision model along with a containerized restful API (FastAPI) for serving streaming detections of vessels in near real time. See [docs/model_card.md](./docs/model_card.md) for information about the model and [docs/openapi.json](./docs/openapi.json) for the API specification. This model was built for [Skylight](https://www.skylight.global/), a product of AI2 that supports maritime transparency through actionable intelligence in order to help protect our oceans.

- +

--- @@ -19,27 +19,36 @@ Note that the model and API are designed to run in resource constrained environm ## Installation +### Using the existing package + Pull the latest package from [GitHub](https://github.com/allenai/vessel-detection-viirs/pkgs/container/vessel-detection-viirs) ```bash -docker pull ghcr.io/vulcanskylight/vessel-detection-viirs +docker pull ghcr.io/vulcanskylight/vessel-detection-viirs:latest ``` Once the package is downloaded, start the service with: ```bash -docker run -d -p 5555:5555 vvd-service +docker run -d -p 5555:5555 -v ABS_PATH_TO_REPO/tests/test_files:/test_files/ ghcr.io/allenai/vessel-detection-viirs:latest ``` -You may override the default port by passing in your preferred port in the docker run command e.g. `-e VVD_PORT=PORT` +Test the service by executing the example request in example/sample_request.py + +```bash +python3 -m venv .venv +source .venv/bin/activate +pip install -r requirements/requirements-inference.txt +python example/sample_request.py +``` -Or clone this repository and build the container with +### Build from source ```bash docker compose up ``` -The service will now be running on port 5555 (verify with `docker ps -a`). +The service will now be running on port 5555 (verify with `docker ps -a`). You may override the port number (default=5555) by passing in your preferred port in the docker run command as an environment variable e.g. `-e VVD_PORT=PORT`. Set that environment variable in your shell as well in order to use the example requests. To query the API with an example request, install `requirements/requirements-inference.txt` on the host. ```bash diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 08a7efa..7a5bc77 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -80,7 +80,7 @@ sympy==1.11.1 threadpoolctl==3.1.0 tifffile==2023.4.12 tomli==2.0.1 -torch==2.0.1 +torch==2.0.1+cpu torchvision==0.15.2 typing_extensions==4.7.0 urllib3<2.0.0 From 1ea5b646ecc7dfb9faa9d1b7a44243512c1aa550 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 13 Jul 2023 17:24:54 -0700 Subject: [PATCH 2/2] specify cpu only build/index url --- readme.md | 2 +- requirements/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 65c3da5..b3fc82f 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ This repository contains a computer vision model along with a containerized restful API (FastAPI) for serving streaming detections of vessels in near real time. See [docs/model_card.md](./docs/model_card.md) for information about the model and [docs/openapi.json](./docs/openapi.json) for the API specification. This model was built for [Skylight](https://www.skylight.global/), a product of AI2 that supports maritime transparency through actionable intelligence in order to help protect our oceans. -

+

diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 7a5bc77..0a006a9 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,3 +1,4 @@ +--extra-index-url https://download.pytorch.org/whl/cpu torch==2.0.1+cpu anyio==3.7.0 appdirs==1.4.4 attrs==23.1.0 @@ -80,7 +81,6 @@ sympy==1.11.1 threadpoolctl==3.1.0 tifffile==2023.4.12 tomli==2.0.1 -torch==2.0.1+cpu torchvision==0.15.2 typing_extensions==4.7.0 urllib3<2.0.0