add cli tutorials
This commit is contained in:
parent
d2a7e3c730
commit
4eff036c1c
|
|
@ -287,8 +287,120 @@
|
||||||
"<div id=\"cli\"></div>\n",
|
"<div id=\"cli\"></div>\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"### Mayavoz CLI"
|
"## Mayavoz CLI"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "2bbf2747",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"! pip install mayavoz[cli]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "4447dd07",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### TL;DR\n",
|
||||||
|
"Calling the following command would train mayavoz Demucs model on DNS-2020 dataset.\n",
|
||||||
|
"\n",
|
||||||
|
"```bash\n",
|
||||||
|
"mayavoz-train \\\n",
|
||||||
|
" model=Demucs \\\n",
|
||||||
|
" Demucs.sampling_rate=16000 \\\n",
|
||||||
|
" dataset=DNS-2020 \\\n",
|
||||||
|
" DNS-2020.name = \"dns-2020\" \\\n",
|
||||||
|
" DNS-2020.root_dir=\"your_root_dir\" \\\n",
|
||||||
|
" DNS-2020.train_clean=\"\" \\\n",
|
||||||
|
" DNS-2020.train_noisy=\"\" \\\n",
|
||||||
|
" DNS-2020.test_clean=\"\" \\\n",
|
||||||
|
" DNS-2020.test_noisy=\"\" \\\n",
|
||||||
|
" DNS-2020.sampling_rate=16000 \\\n",
|
||||||
|
" DNS-2020.duration=2.0 \\\n",
|
||||||
|
" traine=default \\ \n",
|
||||||
|
" default.max_epochs=1 \\\n",
|
||||||
|
"\n",
|
||||||
|
"```\n",
|
||||||
|
"\n",
|
||||||
|
"This is more or less equaivalent to below code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "9278742a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from mayavoz.utils import Files\n",
|
||||||
|
"from mayavoz.data import MayaDataset\n",
|
||||||
|
"from mayavoz.models import Demucs\n",
|
||||||
|
"\n",
|
||||||
|
"files = Files(\n",
|
||||||
|
" train_clean=\"\",\n",
|
||||||
|
" train_noisy=\"\",\n",
|
||||||
|
" test_clean=\"\",\n",
|
||||||
|
" test_noisy=\"\"\n",
|
||||||
|
")\n",
|
||||||
|
"dataset = MayaDataset(\n",
|
||||||
|
" name='dns-2020'\n",
|
||||||
|
" root_dir=\"your_root_dir\",\n",
|
||||||
|
" files=files,\n",
|
||||||
|
" sampling_rate=16000,\n",
|
||||||
|
" duration=2.0)\n",
|
||||||
|
"model = Demucs(dataset=dataset,sampling_rate=16000)\n",
|
||||||
|
"trainer = Trainer(max_epochs=1)\n",
|
||||||
|
"trainer.fit(model)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "eb26692c",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Hydra-based configuration\n",
|
||||||
|
"mayavoz-train relies on Hydra to configure the training process. Adding --cfg job option to the previous command will let you know about the actual configuration used for training:\n",
|
||||||
|
"\n",
|
||||||
|
"```bash\n",
|
||||||
|
"mayavoz-train --cfg job \\\n",
|
||||||
|
" model=Demucs \\\n",
|
||||||
|
" Demucs.sampling_rate=16000 \\\n",
|
||||||
|
" dataset=DNS-2020\n",
|
||||||
|
"\n",
|
||||||
|
"```\n",
|
||||||
|
"\n",
|
||||||
|
"```yaml\n",
|
||||||
|
"_target_: enhancer.models.demucs.Demucs\n",
|
||||||
|
"num_channels: 1\n",
|
||||||
|
"resample: 4\n",
|
||||||
|
"sampling_rate : 16000\n",
|
||||||
|
"\n",
|
||||||
|
"encoder_decoder:\n",
|
||||||
|
" depth: 4\n",
|
||||||
|
" initial_output_channels: 64\n",
|
||||||
|
" \n",
|
||||||
|
"[...]\n",
|
||||||
|
"```\n",
|
||||||
|
"\n",
|
||||||
|
"To change the sampling_rate, you can \n",
|
||||||
|
"\n",
|
||||||
|
"```bash\n",
|
||||||
|
"mayavoz-train \\\n",
|
||||||
|
" model=Demucs model.sampling_rate=16000 \\\n",
|
||||||
|
" dataset=DNS-2020\n",
|
||||||
|
"\n",
|
||||||
|
"```"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "93555860",
|
||||||
|
"metadata": {},
|
||||||
|
"source": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue