voice-changer/start2.sh

87 lines
2.3 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
2022-11-03 21:20:43 +03:00
DOCKER_IMAGE=dannadori/voice-changer:20221104_031752
2022-10-02 18:16:46 +03:00
#DOCKER_IMAGE=voice-changer
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
MODE=$1
PARAMS=${@:2:($#-1)}
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
### DEFAULT VAR ###
DEFAULT_EX_PORT=18888
DEFAULT_USE_GPU=on # on|off
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}}
USE_GPU=${USE_GPU:-${DEFAULT_USE_GPU}}
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
### INTERNAL SETTING ###
TENSORBOARD_PORT=6006
SIO_PORT=8080
2022-08-26 04:49:26 +03:00
2022-10-02 18:16:46 +03:00
###
if [ "${MODE}" = "MMVC_TRAIN" ]; then
echo "トレーニングを開始します"
docker run -it --gpus all --shm-size=128M \
-v `pwd`/exp/${name}/dataset:/MMVC_Trainer/dataset \
-v `pwd`/exp/${name}/logs:/MMVC_Trainer/logs \
-v `pwd`/exp/${name}/filelists:/MMVC_Trainer/filelists \
-v `pwd`/vc_resources:/resources \
-e LOCAL_UID=$(id -u $USER) \
-e LOCAL_GID=$(id -g $USER) \
-e EX_IP="`hostname -I`" \
-e EX_PORT=${EX_PORT} \
-e VERBOSE=${VERBOSE} \
-p ${EX_PORT}:6006 $DOCKER_IMAGE "$@"
elif [ "${MODE}" = "MMVC" ]; then
if [ "${USE_GPU}" = "on" ]; then
echo "MMVCを起動します(with gpu)"
2022-08-26 04:49:26 +03:00
docker run -it --gpus all --shm-size=128M \
-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} \
-e VERBOSE=${VERBOSE} \
-p ${EX_PORT}:8080 $DOCKER_IMAGE "$@"
else
echo "MMVCを起動します(only cpu)"
2022-08-26 04:49:26 +03:00
docker run -it --shm-size=128M \
-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} \
-e VERBOSE=${VERBOSE} \
-p ${EX_PORT}:8080 $DOCKER_IMAGE "$@"
# docker run -it --shm-size=128M \
# -v `pwd`/vc_resources:/resources \
# -e LOCAL_UID=$(id -u $USER) \
# -e LOCAL_GID=$(id -g $USER) \
# -e EX_IP="`hostname -I`" \
# -e EX_PORT=${EX_PORT} \
# -e VERBOSE=${VERBOSE} \
# --entrypoint="" \
# -p ${EX_PORT}:8080 $DOCKER_IMAGE /bin/bash
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-03 13:22:33 +03:00
MODE: select one of ['MMVC_TRAIN', 'MMVC']
2022-10-02 18:16:46 +03:00
" >&2
2022-08-26 04:49:26 +03:00
fi