voice-changer/trainer/exec.sh

64 lines
1.8 KiB
Bash
Raw Normal View History

2022-08-22 21:57:54 +03:00
#!/bin/bash
# 参考:https://programwiz.org/2022/03/22/how-to-write-shell-script-for-option-parsing/
set -eu
2022-10-02 18:16:46 +03:00
MODE=$1
PARAMS=${@:2:($#-1)}
2022-08-22 21:57:54 +03:00
echo "------"
2022-10-02 18:16:46 +03:00
echo "$MODE"
echo "PARAMS: $PARAMS"
echo "VERBOSE: $VERBOSE"
2022-08-22 21:57:54 +03:00
echo "------"
2022-10-02 18:16:46 +03:00
# 起動
2022-11-03 13:22:33 +03:00
if [ "${MODE}" = "MMVC" ] ; then
2022-10-02 18:16:46 +03:00
cd /voice-changer-internal/voice-change-service
2022-08-23 05:17:51 +03:00
2022-11-03 17:56:12 +03:00
ls /resources/* >/dev/null 2>&1
2022-11-03 17:42:00 +03:00
2022-11-03 17:56:12 +03:00
if [ $? -ne 0 ]; then
echo "デフォルトの設定を使用します。"
else
echo "指定された設定を使用します。"
2022-11-03 17:42:00 +03:00
cp -r /resources/* .
fi
2022-11-03 17:56:12 +03:00
2022-10-02 18:16:46 +03:00
if [[ -e ./setting.json ]]; then
cp ./setting.json ../frontend/dist/assets/setting.json
2022-10-02 18:25:07 +03:00
else
cp ../frontend/dist/assets/setting_mmvc.json ../frontend/dist/assets/setting.json
2022-10-02 18:16:46 +03:00
fi
2022-08-23 05:17:51 +03:00
2022-10-02 18:16:46 +03:00
if [ "${VERBOSE}" = "on" ]; then
echo "MMVCを起動します(verbose)"
2022-11-03 13:22:33 +03:00
python3 MMVCServerSIO.py $PARAMS
2022-10-02 18:16:46 +03:00
else
echo "MMVCを起動します"
2022-11-03 17:42:00 +03:00
python3 MMVCServerSIO.py $PARAMS 2>stderr.txt
2022-10-02 18:16:46 +03:00
fi
elif [ "${MODE}" = "MMVC_TRAIN" ] ; then
2022-08-23 05:17:51 +03:00
python3 create_dataset_jtalk.py -f train_config -s 24000 -m dataset/multi_speaker_correspondence.txt
# date_tag=`date +%Y%m%d%H%M%S`
sed -ie 's/80000/8000/' train_ms.py
sed -ie "s/\"batch_size\": 10/\"batch_size\": $batch_size/" configs/train_config.json
sed -ie "s/torch.cuda.device_count()/1/" train_ms.py
python3 -m tensorboard.main --logdir logs --port 6006 --host 0.0.0.0 &
2022-10-02 18:16:46 +03:00
python3 train_ms.py $PARAMS
# if ${resume_flag}; then
# echo "トレーニング再開。バッチサイズ: ${batch_size}。"
# python3 train_ms.py -c configs/train_config.json -m vc
# else
# echo "トレーニング開始。バッチサイズ: ${batch_size}。"
# python3 train_ms.py -c configs/train_config.json -m vc -fg fine_model/G_180000.pth -fd fine_model/D_180000.pth
# fi
2022-08-23 05:17:51 +03:00
fi