Skip to content
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

install cpu torch version instead of nvidia to save space #2

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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.

<p float="left">
<img src="images/summary.png" >
<p float="center">
<img src="images/summary.png" width=700 >
</p>

---
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -80,7 +81,6 @@ sympy==1.11.1
threadpoolctl==3.1.0
tifffile==2023.4.12
tomli==2.0.1
torch==2.0.1
torchvision==0.15.2
typing_extensions==4.7.0
urllib3<2.0.0
Expand Down