voice-changer/trainer/exec.sh

62 lines
2.1 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/
2022-11-03 20:20:57 +03:00
#set -eux
2022-08-22 21:57:54 +03:00
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"
2022-11-03 22:10:47 +03:00
# 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 20:20:57 +03:00
if [[ -e /resources/setting.json ]]; then
echo "指定された設定(setting.json)を使用します。"
cp /resources/setting.json ../frontend/dist/assets/setting.json
2022-10-02 18:25:07 +03:00
else
2022-11-03 20:20:57 +03:00
echo "デフォルトの設定(setting.json)を使用します。"
2022-10-02 18:25:07 +03:00
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-11-03 20:20:57 +03:00
find /resources/ -type f -name "config.json" | xargs -I{} sh -c 'echo "config.jsonをコピーします。" && cp {} ./'
find /resources/ -type f -name "*.pth" | xargs -I{} sh -c 'echo "`basename {}`をコピーします。" && cp {} ./'
2022-11-03 22:10:47 +03:00
# if [ "${VERBOSE}" = "on" ]; then
# echo "MMVCを起動します(verbose)"
# python3 MMVCServerSIO.py $PARAMS
# else
# echo "MMVCを起動します"
# python3 MMVCServerSIO.py $PARAMS 2>stderr.txt
# fi
echo "MMVCを起動します"
python3 MMVCServerSIO.py $PARAMS 2>stderr.txt
2022-10-02 18:16:46 +03:00
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