-
Notifications
You must be signed in to change notification settings - Fork 3k
/
function-gpu.yaml
83 lines (77 loc) · 2.79 KB
/
function-gpu.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
metadata:
name: pth-saic-vul-hrnet
namespace: cvat
annotations:
name: HRNET
version: 2
type: interactor
spec:
min_pos_points: 1
min_neg_points: 0
animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif
help_message: The interactor allows to get a mask for an object using positive points, and negative points
spec:
description: HRNet18 for click based interactive segmentation
runtime: 'python:3.8'
handler: main:handler
eventTimeout: 30s
env:
- name: PYTHONPATH
value: /opt/nuclio/hrnet
build:
image: cvat.pth.saic-vul.hrnet:latest-gpu
baseImage: ubuntu:20.04
directives:
preCopy:
- kind: ENV
value: DEBIAN_FRONTEND=noninteractive
- kind: RUN
value: apt-get update && apt-get install software-properties-common -y
- kind: RUN
value: add-apt-repository ppa:deadsnakes/ppa
- kind: RUN
value: apt remove python* -y
- kind: RUN
value: apt-get update && apt-get install -y --no-install-recommends build-essential git curl libglib2.0-0 software-properties-common python3 python3.6-dev python3-pip python3-tk
- kind: RUN
value: ln -s /usr/bin/pip3 /usr/local/bin/pip && ln -s /usr/bin/python3 /usr/bin/python
- kind: RUN
value: pip3 install --upgrade pip
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
value: git clone https://github.com/saic-vul/ritm_interactive_segmentation.git hrnet
- kind: WORKDIR
value: /opt/nuclio/hrnet
- kind: RUN
value: apt-get install -y --no-install-recommends wget
- kind: RUN
value: wget https://github.com/saic-vul/ritm_interactive_segmentation/releases/download/v1.0/coco_lvis_h18_itermask.pth
- kind: RUN
value: pip3 install setuptools
- kind: RUN
value: pip3 install -r requirements.txt "numpy<1.24" # the NumPy version is not pinned and HRNet uses np.int which throws an error for NumPy >= 1.24 (PR#5574)
- kind: RUN
value: apt update && apt install -y libgl1-mesa-glx
- kind: RUN
value: pip3 uninstall torch torch vision -y
- kind: RUN
value: pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
- kind: WORKDIR
value: /opt/nuclio
triggers:
myHttpTrigger:
maxWorkers: 1
kind: 'http'
workerAvailabilityTimeoutMilliseconds: 10000
attributes:
maxRequestBodySize: 33554432 # 32MB
resources:
limits:
nvidia.com/gpu: 1
platform:
attributes:
restartPolicy:
name: always
maximumRetryCount: 3
mountMode: volume