voice-changer/demo/MMVC_Trainer/notebook/01_Create_Configfile.ipynb
2022-12-09 13:15:52 +09:00

256 lines
8.5 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "Q3egrWHAzs7H"
},
"source": [
"# MMVCの学習に必要なconfig系Fileを作成する\n",
"\n",
"ver.2022/08/10\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "V61VE7vxLaY3"
},
"source": [
"## 1 概要\n",
"「Google Colaboratory」を利用した、MMVCの学習を実行するために必要なファイルを生成します。"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kN0-Tj3TL-T2"
},
"source": [
"## 2 Google Drive をマウント\n",
"**Google Drive にアップロードした MMVC_Trainer を参照できるように、設定します。**\n",
"\n",
"「このノートブックに Google ドライブのファイルへのアクセスを許可しますか?」\n",
"\n",
"といったポップアップが表示されるので、「Google ドライブに接続」を押下し、google アカウントを選択して、「許可」を選択してください。\n",
"\n",
"成功すれば、下記メッセージが出ます。\n",
"```\n",
"Mounted at /content/drive/\n",
"```\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "hdfce8bPkpMB"
},
"outputs": [],
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive')"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "AXCsRWVLNn0c"
},
"source": [
"cdコマンドを実行して、マウントしたGoogle Drive のMMVC_Trainerディレクトリに移動します。\n",
"\n",
"%cd 「MMVC_Trainerをgoogle driveにパップロードしたパス」\n",
"\n",
"としてください。\n",
"\n",
"正しいパスが指定されていれば\n",
"\n",
"-rw------- 1 root root 11780 Mar 4 16:53 attentions.py\n",
"\n",
"-rw------- 1 root root 4778 Mar 4 16:53 commons.py\n",
"\n",
"drwx------ 2 root root 4096 Mar 5 15:20 configs\n",
"\n",
"...といった感じに表示されるはずです。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cLxKrVTGkvsq"
},
"outputs": [],
"source": [
"%cd /content/drive/MyDrive/\n",
"!ls -la"
]
},
{
"cell_type": "markdown",
"source": [
"## 3 事前学習済みモデルのダウンロード\n",
"\n",
"fine_model 以下に、事前学習済みモデルをダウンロードします。"
],
"metadata": {
"id": "fzAFp785nH_R"
}
},
{
"cell_type": "code",
"source": [
"!fileid=\"1MRmB-9EL2-xhxIIraVx20qWqyX-8ZMPw\"; filename=\"fine_model/G_180000.pth\"; html=`curl -c ./cookie -s -L \"https://drive.google.com/uc?export=download&id=${fileid}\"`; curl -Lb ./cookie \"https://drive.google.com/uc?export=download&`echo ${html}|grep -Po '(confirm=[a-zA-Z0-9\\-_]+)'`&id=${fileid}\" -o ${filename}\n",
"!fileid=\"1oPbMM7cGz-z0fLgj7DW_wPGRCwvgD2jZ\"; filename=\"fine_model/D_180000.pth\"; html=`curl -c ./cookie -s -L \"https://drive.google.com/uc?export=download&id=${fileid}\"`; curl -Lb ./cookie \"https://drive.google.com/uc?export=download&`echo ${html}|grep -Po '(confirm=[a-zA-Z0-9\\-_]+)'`&id=${fileid}\" -o ${filename}"
],
"metadata": {
"id": "oLtpgNckjreW"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "FS1ttfpyPckq"
},
"source": [
"## 4 必要なライブラリのインストール\n",
"\n",
"何も考えず実行してください。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "XDLDiK1Sk3uZ"
},
"outputs": [],
"source": [
"!pip install pyopenjtalk"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jX2VRWu4Pvqy"
},
"source": [
"## 5 MMVCの学習に必要なconfig系Fileを作成する\n",
"\n",
"学習に必要なファイルを実行します。 \n",
"オプションは-f -s -tがあります。普通に使う際には-cは不要です。 \n",
"-f 作成するconfig系Fileの名前です。よくわからない人は変更不要です。 \n",
"-s サンプリングレートです。datasetの音声のサンプリングレートに合わせて指定ください。よくわからない人は変更不要です。 \n",
"-t 既にモデルに学習されているデータの場合利用します。ずんだもんの場合は「100」 それ以外のサポートキャラは「101103」 非サポートキャラは「108」を指定します。\n",
"\n",
"\n",
"実行時に \n",
"**「WARNING: JPCommonLabel_insert_pause() in jpcommon_label.c: First mora should not be short pause.」** \n",
"と表示されますが、無視して大丈夫です。 \n",
"\n",
"「filelists」ディレクトリに \n",
"「指定したconfig系Fileの名前_textful.txt」 \n",
"「指定したconfig系Fileの名前_textful_val.txt」 \n",
"「指定したconfig系Fileの名前_textless.txt」 \n",
"「指定したconfig系Fileの名前_val_textless.txt」 \n",
"「指定したconfig系Fileの名前_Correspondence.txt」 \n",
"上記5ファイル\n",
"\n",
"「configs」ディレクトリに \n",
"「指定したconfig系Fileの名前.json」 \n",
"上記1ファイルが生成されていれば、成功です。 \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5.1 チュートリアル:ずんだもんになる\n",
"下記セルを実行してください。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "qbh1TvLRk5pu"
},
"outputs": [],
"source": [
"!python create_dataset_jtalk.py -f train_config_zundamon -s 24000 -t 100"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "j0vi8pdVggbY"
},
"source": [
"### 5.2 ずんだもん以外の話者の学習を行う\n",
"ずんだもん以外の話者の学習を行う場合、下記セルを実行してください。 \n",
"**九州そらの学習を行いたい場合、「108」を「101」に \n",
"四国めたんの学習を行いたい場合、「108」を「102」に \n",
"春日部つむぎの学習を行いたい場合、「108」を「103」に** \n",
"設定するとクオリティがあがる**かも**しれません。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "HkN9EC7aggbZ"
},
"outputs": [],
"source": [
"!python create_dataset_jtalk.py -f train_config -s 24000 -t 108"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5.3 応用編 同時に複数話者の学習を行う\n",
"複数の話者を同時に学習したい場合、下記セルを実行してください。 \n",
"multi_speaker_correspondence.txt を下記フォーマットに任意に書き換えて、実行してください。 \n",
"textful配下のディレクトリ名|0109の番号 "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!python create_dataset_jtalk.py -f train_config_test -s 24000 -m dataset/multi_speaker_correspondence.txt"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "01_Create_Configfile.ipynb",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3.9.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.9.6"
},
"vscode": {
"interpreter": {
"hash": "d3394867249fd41ee68869925f4586b97ae8a94f3c93a4c25403e9e75f272611"
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}