Spaces:
Building
Building
Create torchserve_setup.sh
Browse files- torchserve_setup.sh +46 -0
torchserve_setup.sh
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
set -e
|
3 |
+
|
4 |
+
# install os dependencies
|
5 |
+
mkdir -p /usr/share/man/man1
|
6 |
+
apt-get update && \
|
7 |
+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
8 |
+
ca-certificates \
|
9 |
+
curl \
|
10 |
+
vim \
|
11 |
+
sudo \
|
12 |
+
default-jre \
|
13 |
+
git \
|
14 |
+
gcc \
|
15 |
+
build-essential \
|
16 |
+
&& rm -rf /var/lib/apt/lists/*
|
17 |
+
|
18 |
+
# Install desired Python version
|
19 |
+
conda install python=3.8.13 -y
|
20 |
+
|
21 |
+
# install python dependencies
|
22 |
+
pip install openmim
|
23 |
+
pip install torch==2.0.0
|
24 |
+
mim install mmcv-full==1.7.0
|
25 |
+
pip install mmdet==2.27.0
|
26 |
+
pip install torchserve
|
27 |
+
|
28 |
+
# bugfix for xtcocoapi, an mmpose dependency
|
29 |
+
git clone https://github.com/jin-s13/xtcocoapi.git
|
30 |
+
cd xtcocoapi
|
31 |
+
pip install -r requirements.txt
|
32 |
+
python setup.py install
|
33 |
+
cd /
|
34 |
+
|
35 |
+
# Additional dependencies
|
36 |
+
pip install mmpose==0.29.0
|
37 |
+
pip install torchvision==0.15.1 # solve torch version problem
|
38 |
+
pip install numpy==1.24.4 # solve numpy version problem
|
39 |
+
|
40 |
+
# prep torchserve
|
41 |
+
mkdir -p /home/torchserve/model-store
|
42 |
+
wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/torchserve/model-store/
|
43 |
+
wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/torchserve/model-store/
|
44 |
+
|
45 |
+
# Copy config.properties
|
46 |
+
cp torchserve/config.properties /home/torchserve/config.properties
|