Skip to content

Commit d45a7f6

Browse files
Add Resnet Inference Example (skypilot-org#1164)
* Add Resnet Inference * Address comments
1 parent 427081e commit d45a7f6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

examples/resnet_inference_app.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Runs ResNet in inference mode on the fake_imagenet dataset
2+
#
3+
# Usage:
4+
# sky launch -c infer resnet_inference_app.yaml
5+
# sky down infer
6+
7+
name: resnet-inference
8+
9+
resources:
10+
accelerators:
11+
V100: 1
12+
13+
file_mounts:
14+
/tmp/resnet-model-dir:
15+
source: s3://mluo-resnet-model-dir
16+
17+
18+
setup: |
19+
git clone https://github.com/concretevitamin/tpu || true
20+
cd tpu
21+
git checkout gpu_train
22+
23+
. $(conda info --base)/etc/profile.d/conda.sh
24+
pip install --upgrade pip
25+
26+
conda activate resnet
27+
28+
if [ $? -eq 0 ]; then
29+
echo "conda env exists"
30+
else
31+
conda create -n resnet python=3.7 -y
32+
conda activate resnet
33+
conda install cudatoolkit=11.0 -y
34+
pip install tensorflow==2.4.0 pyyaml
35+
pip install protobuf==3.20
36+
cd models
37+
pip install -e .
38+
fi
39+
40+
run: |
41+
cd tpu
42+
. $(conda info --base)/etc/profile.d/conda.sh
43+
conda activate resnet
44+
45+
export XLA_FLAGS='--xla_gpu_cuda_data_dir=/usr/local/cuda/'
46+
python -u models/official/resnet/resnet_main.py --use_tpu=False \
47+
--mode=infer --data_dir=gs://cloud-tpu-test-datasets/fake_imagenet \
48+
--model_dir=/tmp/resnet-model-dir --amp --xla --loss_scale=128 \
49+
--infer_batch_size=8 --infer_steps=10000

0 commit comments

Comments
 (0)