File size: 5,216 Bytes
ebcd3d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "private_outputs": true,
      "provenance": [],
      "gpuType": "T4"
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "#@title Check GPU\n",
        "!nvidia-smi"
      ],
      "metadata": {
        "id": "UYsjRYl6IGdY"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Mount Google Drive\n",
        "from google.colab import drive\n",
        "drive.mount('/content/drive')"
      ],
      "metadata": {
        "id": "XDF6CLukIMBY"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Install dependencies\n",
        "#@markdown pip may fail to resolve dependencies and raise ERROR, but it can be ignored.\n",
        "!python -m pip install -U pip wheel\n",
        "%pip install -U ipython\n",
        "\n",
        "#@markdown Branch (for development)\n",
        "BRANCH = \"none\" #@param {\"type\": \"string\"}\n",
        "if BRANCH == \"none\":\n",
        "    %pip install -U so-vits-svc-fork\n",
        "else:\n",
        "    %pip install -U git+https://github.com/34j/so-vits-svc-fork.git@{BRANCH}"
      ],
      "metadata": {
        "id": "i_nqeMhAITlQ"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Make dataset directory\n",
        "!mkdir -p \"dataset_raw\""
      ],
      "metadata": {
        "id": "A4mLrAx1IfXJ"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#!rm -r \"dataset_raw\"\n",
        "#!rm -r \"dataset/44k\""
      ],
      "metadata": {
        "id": "XP7DwtUJIh-Q"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Copy your dataset\n",
        "#@markdown Hãy tạo thư mục trên drive và upload các file âm thanh đã được split 10s\n",
        "import shutil\n",
        "# shutil.rmtree(\"/content/dataset_raw/dataset\", ignore_errors=False, onerror=None)\n",
        "DATASET_NAME = \"hana-hoang\" #@param {type: \"string\"}\n",
        "#@markdown Nơi lưu trữ dataset\n",
        "DATASET_LOCATION = \"huggingface\" # @param [\"huggingface\", \"drive\"]\n",
        "if DATASET_LOCATION == \"huggingface\":\n",
        "    !git clone https://huggingface.co/vunhucuongit/sach-noi-model\n",
        "    DATASET_PATH = \"/content/sach-noi-model/hana-hoang/dataset\"\n",
        "    shutil.copytree(DATASET_PATH, \"/content/dataset_raw/dataset/\")\n",
        "else:\n",
        "    DATASET_PATH = f\"/content/drive/MyDrive/TTS/{DATASET_NAME}/\"\n",
        "\n"
      ],
      "metadata": {
        "id": "XAgGNnLzIkpm"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import shutil\n",
        "shutil.copytree(\"/content/sach-noi-model/hana-hoang/logs/44k\", \"/content/drive/MyDrive/TTS/hana-hoang\")"
      ],
      "metadata": {
        "id": "TgqgcJw-hlAP"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import shutil\n",
        "shutil.rmtree(\"/content/sach-noi-model\", ignore_errors=False, onerror=None)"
      ],
      "metadata": {
        "id": "ki8j8Fh3i8s0"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Automatic preprocessing\n",
        "!svc pre-resample"
      ],
      "metadata": {
        "id": "qd_DTQkzIoPW"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "!svc pre-config"
      ],
      "metadata": {
        "id": "wiySQuc_Ip4m"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Copy configs file\n",
        "!cp configs/44k/config.json drive/MyDrive/TTS/hana-hoang"
      ],
      "metadata": {
        "id": "YVseyFdTIs6e"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "F0_METHOD = \"dio\" #@param [\"crepe\", \"crepe-tiny\", \"parselmouth\", \"dio\", \"harvest\"]\n",
        "!svc pre-hubert -fm {F0_METHOD}"
      ],
      "metadata": {
        "id": "yHuKImneIuc_"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Train\n",
        "# %load_ext tensorboard\n",
        "# %tensorboard --logdir drive/MyDrive/TTS/hana-hoang/logs/44k\n",
        "!svc train --model-path /content/drive/MyDrive/TTS/hana-hoang"
      ],
      "metadata": {
        "id": "HC1vG1GAIwUG"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}