forked from omertov/encoder4editing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrundocker.sh
executable file
·50 lines (41 loc) · 1.46 KB
/
rundocker.sh
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
#!/bin/bash
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
set -e
# Wrapper script for setting up `docker run` to properly
# cache downloaded files, custom extension builds and
# mount the source directory into the container and make it
# run as non-root user.
#
# Use it like:
#
# ./docker_run.sh python generate.py --help
#
# To override the default `stylegan2ada:latest` image, run:
#
# IMAGE=my_image:v1.0 ./docker_run.sh python generate.py --help
#
rest=$@
IMAGE="${IMAGE:-e4e:latest}"
PORT=8083
if [[ ! -v GPUDEVICE ]]; then
GPUS="all"
else
GPUS="'\"device=${GPUDEVICE}\"'"
fi
CONTAINER_ID=$(docker inspect --format="{{.Id}}" ${IMAGE} 2> /dev/null)
if [[ "${CONTAINER_ID}" ]]; then
docker run --shm-size=2g --gpus $GPUS -it --rm -v `pwd`:/app \
-p $PORT:8080 \
--workdir=/app $IMAGE $@
# --user $(id -u):$(id -g) \
else
echo "Unknown container image: ${IMAGE}"
exit 1
fi
# docker run --shm-size=2g --gpus all --restart unless-stopped -v `pwd`:/app -w /app -p "8083:8080" --name encoderapi -d --network checkfaceapi e4e python scripts/server_inference.py