voice-changer/start2.sh

81 lines
2.1 KiB
Bash
Raw Normal View History

2022-08-26 04:49:26 +03:00
#!/bin/bash
2022-10-02 18:16:46 +03:00
set -eu
2022-08-26 04:49:26 +03:00
2023-01-12 18:03:45 +03:00
DOCKER_IMAGE=dannadori/voice-changer:20230113_000254
2023-01-11 12:14:52 +03:00
# DOCKER_IMAGE=voice-changer
2022-08-26 04:49:26 +03:00
2022-11-12 03:37:03 +03:00
if [ $# = 0 ]; then
echo "
usage:
$0 <MODE> <params...>
MODE: select one of ['TRAIN', 'MMVC']
" >&2
exit 1
fi
2022-10-02 18:16:46 +03:00
MODE=$1
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
### DEFAULT VAR ###
DEFAULT_EX_PORT=18888
2022-11-08 13:00:47 +03:00
DEFAULT_EX_TB_PORT=16006
2022-10-02 18:16:46 +03:00
DEFAULT_USE_GPU=on # on|off
2022-11-03 22:10:47 +03:00
# DEFAULT_VERBOSE=off # on|off
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
### ENV VAR ###
EX_PORT=${EX_PORT:-${DEFAULT_EX_PORT}}
2022-11-08 13:00:47 +03:00
EX_TB_PORT=${EX_TB_PORT:-${DEFAULT_EX_TB_PORT}}
2022-10-02 18:16:46 +03:00
USE_GPU=${USE_GPU:-${DEFAULT_USE_GPU}}
2022-11-03 22:10:47 +03:00
# VERBOSE=${VERBOSE:-${DEFAULT_VERBOSE}}
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
#echo $EX_PORT $USE_GPU $VERBOSE
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
###
2022-11-12 03:26:28 +03:00
if [ "${MODE}" = "TRAIN" ]; then
2022-10-02 18:16:46 +03:00
echo "トレーニングを開始します"
2022-12-10 23:26:21 +03:00
docker run -it --rm --gpus all --shm-size=128M \
2022-12-13 09:17:00 +03:00
-v `pwd`/work_dir/logs:/voice-changer-internal/voice-change-service/MMVC_Trainer/logs \
-v `pwd`/work_dir/dataset:/voice-changer-internal/voice-change-service/MMVC_Trainer/dataset \
2022-12-13 16:03:42 +03:00
-v `pwd`/work_dir/info:/voice-changer-internal/voice-change-service/info \
2022-10-02 18:16:46 +03:00
-e LOCAL_UID=$(id -u $USER) \
-e LOCAL_GID=$(id -g $USER) \
2022-11-08 13:00:47 +03:00
-e EX_PORT=${EX_PORT} -e EX_TB_PORT=${EX_TB_PORT} \
2022-10-02 18:16:46 +03:00
-e EX_IP="`hostname -I`" \
2022-11-08 13:00:47 +03:00
-p ${EX_PORT}:8080 -p ${EX_TB_PORT}:6006 \
2022-11-12 04:48:13 +03:00
$DOCKER_IMAGE "$@"
2022-11-08 13:00:47 +03:00
2022-10-02 18:16:46 +03:00
elif [ "${MODE}" = "MMVC" ]; then
if [ "${USE_GPU}" = "on" ]; then
echo "MMVCを起動します(with gpu)"
2022-08-26 04:49:26 +03:00
2022-12-10 23:26:21 +03:00
docker run -it --rm --gpus all --shm-size=128M \
2022-08-26 04:49:26 +03:00
-v `pwd`/vc_resources:/resources \
-e LOCAL_UID=$(id -u $USER) \
-e LOCAL_GID=$(id -g $USER) \
2022-10-02 18:16:46 +03:00
-e EX_IP="`hostname -I`" \
-e EX_PORT=${EX_PORT} \
2022-11-12 04:28:36 +03:00
-p ${EX_PORT}:8080 \
2022-11-12 04:48:13 +03:00
$DOCKER_IMAGE "$@"
2022-10-02 18:16:46 +03:00
else
echo "MMVCを起動します(only cpu)"
2022-12-10 23:26:21 +03:00
docker run -it --rm --shm-size=128M \
2022-08-26 04:49:26 +03:00
-v `pwd`/vc_resources:/resources \
-e LOCAL_UID=$(id -u $USER) \
-e LOCAL_GID=$(id -g $USER) \
2022-10-02 18:16:46 +03:00
-e EX_IP="`hostname -I`" \
-e EX_PORT=${EX_PORT} \
2022-11-12 04:27:34 +03:00
-p ${EX_PORT}:8080 \
2022-11-12 04:48:13 +03:00
$DOCKER_IMAGE "$@"
2022-08-26 04:49:26 +03:00
fi
2022-10-02 18:16:46 +03:00
else
echo "
usage:
$0 <MODE> <params...>
2022-11-12 03:26:28 +03:00
MODE: select one of ['TRAIN', 'MMVC']
2022-10-02 18:16:46 +03:00
" >&2
2022-08-26 04:49:26 +03:00
fi