2022-10-29 19:01:30 +03:00
|
|
|
|
{
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|
"nbformat_minor": 0,
|
|
|
|
|
"metadata": {
|
|
|
|
|
"colab": {
|
|
|
|
|
"provenance": [],
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"authorship_tag": "ABX9TyOOGTmM3OfSQrjI1rtDD0EX",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"include_colab_link": true
|
|
|
|
|
},
|
|
|
|
|
"kernelspec": {
|
|
|
|
|
"name": "python3",
|
|
|
|
|
"display_name": "Python 3"
|
|
|
|
|
},
|
|
|
|
|
"language_info": {
|
|
|
|
|
"name": "python"
|
|
|
|
|
},
|
|
|
|
|
"accelerator": "GPU",
|
|
|
|
|
"gpuClass": "standard"
|
|
|
|
|
},
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "view-in-github",
|
|
|
|
|
"colab_type": "text"
|
|
|
|
|
},
|
|
|
|
|
"source": [
|
|
|
|
|
"<a href=\"https://colab.research.google.com/github/w-okada/voice-changer/blob/dev/VoiceChangerDemo_Simple.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"source": [
|
2022-12-04 15:57:00 +03:00
|
|
|
|
"MMVCプレイヤー(超簡単版)\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"---\n",
|
|
|
|
|
"\n",
|
2022-12-04 15:57:00 +03:00
|
|
|
|
"このノートはColab上でMMVCのボイチェンを行うノートです。\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"\n",
|
|
|
|
|
"正式版はローカルPCのDocker上で動かすアプリケーションです。\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"正式版は、多くの場合より少ないタイムラグで滑らかに音声を変換できます。\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"詳細な使用方法はこちらの[リポジトリ](https://github.com/w-okada/voice-changer)からご確認ください。\n"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "Lbbmx_Vjl0zo"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"source": [
|
|
|
|
|
"# GPUを確認\n",
|
|
|
|
|
"GPUを用いたほうが高速に処理が行えます。\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"下記のコマンドでGPUが確認できない場合は、上のメニューから\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"「ランタイム」→「ランタイムの変更」→「ハードウェア アクセラレータ」\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"でGPUを選択してください。"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "oUKi1NYMmXrr"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [
|
|
|
|
|
"# (1) GPUの確認\n",
|
|
|
|
|
"!nvidia-smi"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"colab": {
|
|
|
|
|
"base_uri": "https://localhost:8080/"
|
|
|
|
|
},
|
|
|
|
|
"id": "vV1t7PBRm-o6",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"outputId": "3eb56aa6-6f07-48b6-d8d9-7941497ee1fd"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"execution_count": 1,
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"text": [
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"Sat Dec 10 05:50:35 2022 \n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
|
|
|
"| NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
|
|
|
|
|
"|-------------------------------+----------------------+----------------------+\n",
|
|
|
|
|
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
|
|
|
|
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
|
|
|
|
|
"| | | MIG M. |\n",
|
|
|
|
|
"|===============================+======================+======================|\n",
|
|
|
|
|
"| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"| N/A 55C P0 27W / 70W | 0MiB / 15109MiB | 0% Default |\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"| | | N/A |\n",
|
|
|
|
|
"+-------------------------------+----------------------+----------------------+\n",
|
|
|
|
|
" \n",
|
|
|
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
|
|
|
"| Processes: |\n",
|
|
|
|
|
"| GPU GI CI PID Type Process name GPU Memory |\n",
|
|
|
|
|
"| ID ID Usage |\n",
|
|
|
|
|
"|=============================================================================|\n",
|
|
|
|
|
"| No running processes found |\n",
|
|
|
|
|
"+-----------------------------------------------------------------------------+\n"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"source": [
|
|
|
|
|
"# リポジトリのクローン\n",
|
|
|
|
|
"リポジトリをクローンします"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "sLBfykjBnjWc"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"# (2) リポジトリのクローン\n",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"!git clone --depth 1 https://github.com/w-okada/voice-changer.git -b ver_1.2\n",
|
|
|
|
|
"%cd voice-changer/demo/MMVC_Trainer/monotonic_align \n",
|
2022-12-03 14:29:10 +03:00
|
|
|
|
"!cythonize -3 -i core.pyx &> /dev/null\n",
|
|
|
|
|
"!mv core.cpython-*.so monotonic_align &> /dev/null\n",
|
|
|
|
|
"%cd /content/voice-changer/demo/\n",
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"\n",
|
|
|
|
|
"!cp ../template/setting_mmvc_colab.json ../frontend/dist/assets/setting.json"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"colab": {
|
|
|
|
|
"base_uri": "https://localhost:8080/"
|
|
|
|
|
},
|
|
|
|
|
"id": "86wTFmqsNMnD",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"outputId": "89f55015-3adf-4fc2-a28b-837d41eebc93"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"execution_count": 2,
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"text": [
|
|
|
|
|
"Cloning into 'voice-changer'...\n",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"remote: Enumerating objects: 1030, done.\u001b[K\n",
|
|
|
|
|
"remote: Counting objects: 100% (1030/1030), done.\u001b[K\n",
|
|
|
|
|
"remote: Compressing objects: 100% (919/919), done.\u001b[K\n",
|
|
|
|
|
"remote: Total 1030 (delta 21), reused 983 (delta 11), pack-reused 0\u001b[K\n",
|
|
|
|
|
"Receiving objects: 100% (1030/1030), 71.87 MiB | 26.24 MiB/s, done.\n",
|
|
|
|
|
"Resolving deltas: 100% (21/21), done.\n",
|
|
|
|
|
"Note: checking out 'e824f89e8fac9d202d5ff72ebb13a4e1bf57b4d3'.\n",
|
2022-12-09 04:52:11 +03:00
|
|
|
|
"\n",
|
|
|
|
|
"You are in 'detached HEAD' state. You can look around, make experimental\n",
|
|
|
|
|
"changes and commit them, and you can discard any commits you make in this\n",
|
|
|
|
|
"state without impacting any branches by performing another checkout.\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"If you want to create a new branch to retain commits you create, you may\n",
|
|
|
|
|
"do so (now or later) by using -b with the checkout command again. Example:\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" git checkout -b <new-branch-name>\n",
|
|
|
|
|
"\n",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"/content/voice-changer/demo/MMVC_Trainer/monotonic_align\n",
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"/content/voice-changer/demo\n"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"source": [
|
|
|
|
|
"# モジュールのインストール\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"必要なモジュールをインストールします。"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "8Na2PbLZSWgZ"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"# (3) 設定ファイルの確認\n",
|
2022-10-30 17:38:51 +03:00
|
|
|
|
"!apt-get install -y espeak libsndfile1-dev &> /dev/null\n",
|
|
|
|
|
"!pip install unidecode &> /dev/null\n",
|
|
|
|
|
"!pip install phonemizer &> /dev/null\n",
|
|
|
|
|
"!pip install retry &> /dev/null\n",
|
|
|
|
|
"!pip install python-socketio &> /dev/null\n",
|
|
|
|
|
"!pip install fastapi &> /dev/null\n",
|
|
|
|
|
"!pip install python-multipart &> /dev/null\n",
|
|
|
|
|
"!pip install uvicorn &> /dev/null\n",
|
|
|
|
|
"!pip install websockets &> /dev/null\n",
|
|
|
|
|
"!pip install pyOpenSSL &> /dev/null\n"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
2022-10-30 17:38:51 +03:00
|
|
|
|
"id": "LwZAAuqxX7yY"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"execution_count": 3,
|
2022-10-30 17:38:51 +03:00
|
|
|
|
"outputs": []
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"source": [
|
|
|
|
|
"# サーバの起動\n",
|
|
|
|
|
"\n",
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"サーバを起動します。(4-1)\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"\n",
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"サーバの起動状況を確認します。(4-2) \n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"\n",
|
|
|
|
|
"このセルは繰り返し実行することになるのでCtrl+Retでセルを実行してください。\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"下記のようなテキストが表示されたら起動完了です。\n",
|
|
|
|
|
"\n",
|
2022-10-30 17:38:51 +03:00
|
|
|
|
"**`DEBUG:asyncio:Using selector: EpollSelector`**\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"\n",
|
|
|
|
|
"```\n",
|
2022-10-30 17:38:51 +03:00
|
|
|
|
" Phase name:__main__\n",
|
|
|
|
|
" PHASE3:__main__\n",
|
|
|
|
|
" PHASE1:__main__\n",
|
|
|
|
|
"Start MMVC SocketIO Server\n",
|
|
|
|
|
" CONFIG:None, MODEL:None\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"DEBUG:asyncio:Using selector: EpollSelector\n",
|
|
|
|
|
"```\n",
|
|
|
|
|
"\n"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "-_2OcN9Borke"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"# (4-1) サーバの起動\n",
|
2022-10-30 13:19:27 +03:00
|
|
|
|
"import random\n",
|
|
|
|
|
"PORT = 10000 + random.randint(1, 9999)\n",
|
|
|
|
|
"LOG_FILE = f\"LOG_FILE_{PORT}\"\n",
|
|
|
|
|
"\n",
|
2022-11-12 07:22:08 +03:00
|
|
|
|
"get_ipython().system_raw(f'python3 MMVCServerSIO.py -t MMVC -p {PORT} --colab True >{LOG_FILE} 2>&1 &')\n",
|
2022-10-30 17:38:51 +03:00
|
|
|
|
"#print(f\"PORT:{PORT}, LOG_FILE:{LOG_FILE}\")"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"id": "G-nMdPxEW1rc"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"execution_count": 4,
|
|
|
|
|
"outputs": []
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"# (4-2) サーバの起動確認\n",
|
2022-12-04 15:57:00 +03:00
|
|
|
|
"!sleep 30\n",
|
2022-10-30 17:38:51 +03:00
|
|
|
|
"!tail -20 {LOG_FILE}"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"colab": {
|
|
|
|
|
"base_uri": "https://localhost:8080/"
|
|
|
|
|
},
|
|
|
|
|
"id": "chu06KpAjEK6",
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"outputId": "93b1d4de-ed30-4203-9d42-7cab541d66e0"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
2022-12-09 04:52:11 +03:00
|
|
|
|
"execution_count": 5,
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"text": [
|
2022-10-30 13:19:27 +03:00
|
|
|
|
"\u001b[32m Phase name:__main__\u001b[0m\n",
|
|
|
|
|
"\u001b[32m PHASE3:__main__\u001b[0m\n",
|
|
|
|
|
"\u001b[32m PHASE1:__main__\u001b[0m\n",
|
|
|
|
|
"\u001b[17mStart MMVC SocketIO Server\u001b[0m\n",
|
|
|
|
|
"\u001b[34m CONFIG:None, MODEL:None\u001b[0m\n",
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"DEBUG:asyncio:Using selector: EpollSelector\n"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"source": [
|
|
|
|
|
"# プロキシを起動\n",
|
|
|
|
|
"ウェブサーバへのアクセスをするためのプロキシを起動します。\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"表示されたURLをクリックして開くと別タブでアプリが開きます。\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"Colabなので、ロードにある程度時間がかかります(30秒くらい)。"
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "WhxcFLQEpctq"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [
|
2022-11-04 00:56:46 +03:00
|
|
|
|
"# (5) プロキシを起動\n",
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"from google.colab.output import eval_js\n",
|
|
|
|
|
"proxy = eval_js( \"google.colab.kernel.proxyPort(\" + str(PORT) + \")\" )\n",
|
2022-10-30 13:19:27 +03:00
|
|
|
|
"print(f\"{proxy}front/\")"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "nkRjZm95l87C",
|
|
|
|
|
"colab": {
|
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
|
"height": 34
|
|
|
|
|
},
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"outputId": "621e17e1-9b6b-4b9b-91d3-c8672ec14551"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
},
|
2022-12-04 15:57:00 +03:00
|
|
|
|
"execution_count": 6,
|
2022-10-29 19:01:30 +03:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"text": [
|
2022-12-10 08:53:12 +03:00
|
|
|
|
"https://kgz69kf9nk9-496ff2e9c6d22116-19462-colab.googleusercontent.com/front/\n"
|
2022-10-29 19:01:30 +03:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
2022-10-29 19:57:03 +03:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"source": [],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"id": "axkt5BjhoiPV"
|
|
|
|
|
},
|
2022-12-04 15:57:00 +03:00
|
|
|
|
"execution_count": 6,
|
2022-10-29 19:57:03 +03:00
|
|
|
|
"outputs": []
|
2022-10-29 19:01:30 +03:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|