Skip to content

Commit 90d000e

Browse files
committed
Use GPU for test/apis/batch/image-classifier-alexnet
1 parent 1d2092f commit 90d000e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Diff for: test/apis/batch/image-classifier-alexnet/app/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def handle_batch(image_urls: List[str]):
7373
tensor_list.append(app.preprocess(img_pil))
7474

7575
# classify the batch of images
76-
img_tensor = torch.stack(tensor_list)
76+
img_tensor = torch.stack(tensor_list).to(app.device)
7777
with torch.no_grad():
7878
prediction = app.model(img_tensor)
7979
_, indices = prediction.max(1)

Diff for: test/apis/batch/image-classifier-alexnet/cortex_gpu.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- name: api
66
image: quay.io/cortexlabs-test/batch-image-classifier-alexnet-gpu:latest
77
command: ["uvicorn", "--workers", "1", "--host", "0.0.0.0", "--port", "$(CORTEX_PORT)", "main:app"]
8+
env:
9+
TARGET_DEVICE: "cuda"
810
readiness_probe:
911
http_get:
1012
path: "/healthz"

Diff for: test/apis/batch/image-classifier-alexnet/gpu.Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ RUN apt-get update \
88
build-essential \
99
git \
1010
cmake \
11+
libjpeg8-dev \
12+
zlib1g-dev \
1113
&& apt-get clean -qq && rm -rf /var/lib/apt/lists/*
1214

1315
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8

0 commit comments

Comments
 (0)