From 4eff036c1c41d3a012a6dc573dd663ced1d7fcda Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 10 Nov 2022 12:03:59 +0530 Subject: [PATCH] add cli tutorials --- notebooks/Getting_started.ipynb | 114 +++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/notebooks/Getting_started.ipynb b/notebooks/Getting_started.ipynb index 05067cd..8e9506c 100644 --- a/notebooks/Getting_started.ipynb +++ b/notebooks/Getting_started.ipynb @@ -287,8 +287,120 @@ "
\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": {