File size: 11,680 Bytes
f5ced3a |
1 2 |
{"cells":[{"cell_type":"markdown","metadata":{"id":"yIgz4PyCC9eY"},"source":["# Glow-TTS Training\n","Glow-TTS νμ΅ μ§ν\n","μμ±μ λ§ν¬μ μμμ κ²°μ νλ λͺ¨λΈ"]},{"cell_type":"markdown","metadata":{"id":"nMJBiJ6mECO1"},"source":["## 1. λ°νμμ ν λΉλ GPU νμΈ\n","\n","λ§μ½, `GPU: NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.` λΌλ λ©μμ§κ° μΆλ ₯λλ€λ©΄, μμͺ½ λ©λ΄μμ `λ°νμ -> λ°νμ μ ν λ³κ²½`μ ν΄λ¦νκ³ νλμ¨μ΄ κ°μκΈ°λ₯Ό `GPU`λ‘ λ³κ²½νμ¬ μ μ₯ν ν λ€μ μ€ν νμ"]},{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":742,"status":"ok","timestamp":1685149753708,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"pHat88bRD4_e","outputId":"ae42575e-4d76-4b02-d10f-8f7d855819b8"},"outputs":[{"name":"stdout","output_type":"stream","text":["GPU: Tesla T4\n"]}],"source":["import os\n","GPU_NAME = os.popen('nvidia-smi --query-gpu=name --format=csv,noheader').read().strip()\n","os.environ['GPU_NAME'] = GPU_NAME\n","print(f'GPU: {GPU_NAME}')"]},{"cell_type":"markdown","metadata":{"id":"CEgknkRoDKj9"},"source":["## 2. κ΅¬κΈ λλΌμ΄λΈ λ§μ΄νΈ\n","\n","λ§μ΄νΈν κ΅¬κΈ λλΌμ΄λΈ λ΄μ λ€μ νμΌμ΄ μ‘΄μ¬ν΄μΌν¨\n","\n","- `/Colab Notebooks/data/filelists.zip`"]},{"cell_type":"code","execution_count":2,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":24329,"status":"ok","timestamp":1685149778033,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"4U2wrDOthrsF","outputId":"2f3187bb-05e1-48f3-95f0-905f395f81e3"},"outputs":[{"name":"stdout","output_type":"stream","text":["Mounted at /content/drive\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"markdown","metadata":{"id":"IxpzRw3SDvOL"},"source":["## 3. νμ λΌμ΄λΈλ¬λ¦¬ λ° ν¨μ λΆλ¬μ€κΈ°\n"]},{"cell_type":"code","execution_count":3,"metadata":{"executionInfo":{"elapsed":6,"status":"ok","timestamp":1685149778033,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"jYCym6hXge2_"},"outputs":[],"source":["import sys\n","from pathlib import Path"]},{"cell_type":"code","execution_count":4,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":2765,"status":"ok","timestamp":1685149780793,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"JkWG-L13gReB","outputId":"c820f3d3-43d7-436a-bd25-1f8c1ee72148"},"outputs":[{"name":"stdout","output_type":"stream","text":["/content\n","Cloning into 'TTS'...\n","remote: Enumerating objects: 447, done.\u001b[K\n","remote: Counting objects: 100% (447/447), done.\u001b[K\n","remote: Compressing objects: 100% (413/413), done.\u001b[K\n","remote: Total 447 (delta 56), reused 222 (delta 22), pack-reused 0\u001b[K\n","Receiving objects: 100% (447/447), 13.77 MiB | 17.84 MiB/s, done.\n","Resolving deltas: 100% (56/56), done.\n","/content/TTS\n","/content/TTS/setup.py:15: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.\n"," if LooseVersion(sys.version) < LooseVersion(\"3.6\") or LooseVersion(sys.version) > LooseVersion(\"3.9\"):\n","Traceback (most recent call last):\n"," File \"/content/TTS/setup.py\", line 16, in <module>\n"," raise RuntimeError(\n","RuntimeError: TTS requires python >= 3.6 and <3.9 but your Python version is 3.10.11 (main, Apr 5 2023, 14:15:10) [GCC 9.4.0]\n"]}],"source":["%cd /content\n","!git clone --depth 1 https://github.com/sce-tts/TTS.git -b sce-tts\n","%cd /content/TTS\n","!python setup.py develop"]},{"cell_type":"markdown","metadata":{"id":"iiXsxJtZERyP"},"source":["## 4. νμ΅ν λ°μ΄ν°μ
λΆλ¬μ€κΈ°\n","\n","νμ΅μ μ¬μ©ν μμ± λ°μ΄ν°λ₯Ό κ΅¬κΈ λλΌμ΄λΈμμ κ°μ Έμ¨λ€.\n","\n","mimic recording studioλ‘ μμ±ν `filelists.zip` νμ"]},{"cell_type":"code","execution_count":5,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":5166,"status":"ok","timestamp":1685149785956,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"hExnC_2RhZ3m","outputId":"ee65017a-9473-4ec8-f676-0ee937202b6b"},"outputs":[{"name":"stdout","output_type":"stream","text":["/content/TTS\n"]}],"source":["%cd /content/TTS\n","!cp \"/content/drive/My Drive/Colab Notebooks/data/filelists.zip\" ./filelists.zip\n","!rm -rf ./filelists\n","!unzip -q filelists.zip -d ./filelists"]},{"cell_type":"markdown","metadata":{"id":"qD8zd4SMElbn"},"source":["## 5. μ¬μ νμ΅ λ°μ΄ν° λΆλ¬μ€κΈ°\n","\n","\n","> μ¬μ νμ΅ λ°μ΄ν°κ° κ΅¬κΈ λλΌμ΄λΈμ μ‘΄μ¬νμ§ μμ κ²½μ°, λ€λ₯Έ μ¬λμ μ¬μ νμ΅ λ°μ΄ν°λ₯Ό λ΄λ €λ°μ.\n","\n"]},{"cell_type":"code","execution_count":6,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":32,"status":"ok","timestamp":1685149785960,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"MQxazTNayds-","outputId":"c3cf0aa3-b69e-479f-92b0-e51c93f541fa"},"outputs":[{"name":"stdout","output_type":"stream","text":["/content/TTS\n"]}],"source":["%cd /content/TTS\n","!mkdir -p \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2\"\n","if not Path(\"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/config.json\").exists():\n"," !gdown --id 1DMKLdfZ_gzc_z0qDod6_G8fEXj0zCHvC -O glowtts-v2.zip\n"," !unzip -q glowtts-v2.zip -d ./\n"," !cp -R ./glowtts-v2/* \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/\""]},{"cell_type":"code","execution_count":7,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":29,"status":"ok","timestamp":1685149785961,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"c73wfE5L7uK9","outputId":"859725c8-5287-4b3e-f6d1-bfab3772e250"},"outputs":[{"name":"stdout","output_type":"stream","text":["/content/TTS\n"]}],"source":["%cd /content/TTS\n","if not Path(\"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/scale_stats_new.npy\").exists():\n"," !python TTS/bin/compute_statistics.py \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/config.json\" \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/scale_stats_new.npy\" --data_path \"/content/TTS/filelists/wavs/\""]},{"cell_type":"code","execution_count":8,"metadata":{"executionInfo":{"elapsed":26,"status":"ok","timestamp":1685149785961,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"Q6TCF3Pu-MnV"},"outputs":[],"source":["with open(\"/content/TTS/test_sentences.txt\", mode=\"w\") as f:\n"," f.write(\"\"\"μλ λ¬Έμ₯λ€μ λͺ¨λΈ νμ΅μ μν΄ μ¬μ©νμ§ μμ λ¬Έμ₯λ€μ
λλ€.\n","μμΈνΉλ³μ νΉννκ°κ³Ό νκ°κ³Όμ₯ νκ³Όμ₯.\n","κ²½μ°°μ² μ² μ°½μ΄μ μΈμ² μ°½μ΄μ΄κ³ κ²μ°°μ² μ² μ°½μ΄μ μμ² μ°½μ΄μ΄λ€.\n","μ§ν₯μ μ§μμΌλ‘ μ€κΈ°νλ μΌμ μ§μνλ μΈμ΄ μ΅κ΄μ μ§ν₯ν΄μΌ νλ€.\n","κ·Έλ¬λκΉ μΈκ³μΈμ΄ μ°λ¦¬ μκ°μ μ½κ³ μ°λ¦¬ μκ°μ μ°λ¦¬κ° λ€μ μκ°ν λ‘ ν΄μ κ·Έ μκ°μ΄ λ§μΉ μ°λ¦¬κ° μκ°ν κ²μΈ κ²μ²λΌ μμλ€λ κ±°λ?\"\"\")"]},{"cell_type":"markdown","metadata":{"id":"alQe2KpbE9di"},"source":["## 6. TensorBoard μ€ν\n","\n","νμ΅ μ§νμ νμΈνκΈ° μν΄ TensorBoardλ₯Ό μ€ν\n","\n","μ€μ λ²νΌμ λλ¬ auto reloadλ₯Ό μ€μ ν΄ 30μ΄λ§λ€ μλ κ°±μ κ°λ₯"]},{"cell_type":"code","execution_count":9,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":820},"executionInfo":{"elapsed":5674,"status":"ok","timestamp":1685149791608,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"ydwAZhCQilzJ","outputId":"a3296d49-99d3-4883-9939-ce14229a6367"},"outputs":[{"data":{"application/javascript":"\n (async () => {\n const url = new URL(await google.colab.kernel.proxyPort(6006, {'cache': true}));\n url.searchParams.set('tensorboardColab', 'true');\n const iframe = document.createElement('iframe');\n iframe.src = url;\n iframe.setAttribute('width', '100%');\n iframe.setAttribute('height', '800');\n iframe.setAttribute('frameborder', 0);\n document.body.appendChild(iframe);\n })();\n ","text/plain":["<IPython.core.display.Javascript object>"]},"metadata":{},"output_type":"display_data"}],"source":["%load_ext tensorboard\n","%tensorboard --logdir=\"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2\""]},{"cell_type":"markdown","metadata":{"id":"32XUNFa-FQ-R"},"source":["## 7. Glow-TTS νμ΅ μ§ν\n","\n","νμ΅μ΄ μ μμ μΌλ‘ μ§νλλ©΄, μ΄ μ
μ μ’
λ£λμ§ μκ³ κ³μ μ€νλλ μνλ₯Ό μ μ§νλ€.\n","\n","μ΄μ μ νμ΅μ μ§ννλ λͺ¨λΈμ μ΄μ΄μ νμ΅μ μ§ννμλ €λ©΄ λ€μκ³Ό κ°μ΄ μμ ν ν μ€ννλ€.\n","\n","- μλ μ
μμ 2 ~ 3λ²μ§Έ μ€μ μ½λλ₯Ό μ£Όμμ ν΄μ νλ€λ€\n","- 3λ²μ§Έ μ€μ κ²½λ‘λ₯Ό μ΄μ΄μ νμ΅μ μ§νν λͺ¨λΈμ κ²½λ‘λ‘ λ³κ²½νλ€λ€. \n","(μμ: `/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/glowtts-v2-May-31-2021_08+17AM-d897f2e`)\n","- 4λ²μ§Έ μ€ μλμ μ½λλ₯Ό μ κ±°νλ€.\n"]},{"cell_type":"code","execution_count":10,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":8529,"status":"ok","timestamp":1685149800131,"user":{"displayName":"Cream Ice","userId":"02668969734157440879"},"user_tz":-540},"id":"9Yim0zgJk3cR","outputId":"831e6d6a-c0c3-4109-f266-031d0750c13a"},"outputs":[{"name":"stdout","output_type":"stream","text":["/content/TTS\n","Traceback (most recent call last):\n"," File \"/content/TTS/TTS/bin/train_glow_tts.py\", line 17, in <module>\n"," from TTS.tts.datasets.preprocess import load_meta_data\n","ModuleNotFoundError: No module named 'TTS'\n","Traceback (most recent call last):\n"," File \"/content/TTS/TTS/bin/train_glow_tts.py\", line 17, in <module>\n"," from TTS.tts.datasets.preprocess import load_meta_data\n","ModuleNotFoundError: No module named 'TTS'\n"]}],"source":["%cd /content/TTS\n","!(python TTS/bin/train_glow_tts.py \\\n"," -continue_path \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/glowtts-v2-April-17-2022_04+46AM-3aa165a/checkpoint_32000.pth.tar\")\n","!(python TTS/bin/train_glow_tts.py \\\n"," --config_path \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/glowtts-v2-April-17-2022_04+46AM-3aa165a/config.json\" \\\n"," --coqpit.datasets.0.path \"/content/TTS/filelists\" \\\n"," --coqpit.audio.stats_path \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/scale_stats_new.npy\" \\\n"," --coqpit.test_sentences_file \"/content/TTS/test_sentences.txt\" \\\n"," --coqpit.output_path \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/\" \\\n"," --coqpit.num_loader_workers 2 \\\n"," --coqpit.num_val_loader_workers 2 \\\n"," --restore_path \"/content/drive/My Drive/Colab Notebooks/data/glowtts-v2/model_file.pth.tar\")"]}],"metadata":{"accelerator":"GPU","colab":{"provenance":[{"file_id":"1L5o8joH8LDV37eupNUpqqWrOcw1sGCit","timestamp":1650106813939},{"file_id":"1IlZt42ETvNHthRFXfwNSSH-ftWthxzqr","timestamp":1622371446894},{"file_id":"1UinTd1Kp1ytwPQ4QWA610ZKOVfmPDdn5","timestamp":1596300568469}]},"kernelspec":{"display_name":"Python 3","name":"python3"}},"nbformat":4,"nbformat_minor":0}
|