Spaces:
Running
Running
File size: 5,138 Bytes
9d61c9b |
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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9d8dbc75-dacc-457f-890c-c3d70f1e24ff",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import os\n",
"from pathlib import Path\n",
"\n",
"from lhotse import CutSet\n",
"from lhotse.cut import Cut, MonoCut\n",
"from lhotse.recipes import (\n",
" download_voxceleb1,\n",
" download_voxceleb2,\n",
" hifitts,\n",
" libritts,\n",
" prepare_voxceleb,\n",
")\n",
"from lhotse.dataset import (\n",
" SimpleCutSampler,\n",
" UnsupervisedDataset\n",
")\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "181a454e-1e74-40fd-8d5b-765b65bf6111",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Dataset root path\n",
"root_dir = Path(\"datasets_cache\")\n",
"\n",
"# datasets paths\n",
"hifitts_path = root_dir / \"hifitts\"\n",
"libritts_path = root_dir / \"libritts\"\n",
"librittsr_path = root_dir / \"librittsr\"\n",
"\n",
"num_jobs = os.cpu_count() - 3"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7e6c3a68-b4e9-46ea-89b2-4aeed61f4a64",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading LibriTTS parts: 0%| | 0/1 [00:00<?, ?it/s]"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9d9a20b8128847dca5a17a4ef95f2fb5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"datasets_cache/libritts/train-clean-100.tar.gz: 0%| | 0.00/7.72G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading LibriTTS parts: 100%|ββββββββββ| 1/1 [04:05<00:00, 245.05s/it]\n"
]
},
{
"data": {
"text/plain": [
"PosixPath('datasets_cache/libritts')"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Prepare the LibriTTS dataset\n",
"libritts_root = libritts.download_libritts(\n",
" libritts_path,\n",
" dataset_parts=[\"train-clean-100\"],\n",
")\n",
"libritts_root"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5a0ad3a3-ac47-4498-8f84-afe4d5188780",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading LibriTTS_R parts: 0%| | 0/1 [00:00<?, ?it/s]"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8a542acbc35f4550bc3f93d48393a48e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"datasets_cache/librittsr/train-clean-100.tar.gz: 0%| | 0.00/8.13G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading LibriTTS_R parts: 100%|ββββββββββ| 1/1 [03:54<00:00, 234.67s/it]\n"
]
},
{
"data": {
"text/plain": [
"PosixPath('datasets_cache/librittsr')"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Prepare the LibriTTS-R dataset\n",
"librittsr_root = libritts.download_librittsr(\n",
" librittsr_path,\n",
" dataset_parts=[\"train-clean-100\"],\n",
")\n",
"librittsr_root"
]
},
{
"cell_type": "markdown",
"id": "8ec51bc2-e8bc-4278-88b4-630bd0743a18",
"metadata": {},
"source": [
"### Check restore pipes of voicefixer for original and restored versions of the libri"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bfe4d675-29d8-404e-82dc-6e12ca215a4d",
"metadata": {},
"outputs": [],
"source": [
"from voicefixer import VoiceFixer\n",
"import soundfile as sf\n",
"import tempfile\n",
"\n",
"with tempfile.NamedTemporaryFile(suffix=\".wav\", delete=True) as out_file:\n",
" voicefixer.restore(input=input_file.name, # low quality .wav/.flac file\n",
" output=output_file.name, # save file path\n",
" cuda=True, # GPU acceleration\n",
" mode=0,\n",
" )\n",
" wav_vf, samplerate = sf.read(output_file.name)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "TTS-Framework",
"language": "python",
"name": "tts_framework"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|