Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the Colab notebook and use GUI elements #368

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 50 additions & 121 deletions bin/train/easy_colab.ipynb
Original file line number Diff line number Diff line change
@@ -1,94 +1,42 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "TC3XkMetGWtK"
},
"source": [
"# Neural Amp Modeler (\"Easy Mode\" Trainer)\n",
"This notebook allows you to train a neural amp model based on a pair of input/output WAV files that you have of the amp you want to model.\n",
"\n",
"**Note**:\n",
"This notebook is meant to be used on [Google Colab](https://colab.research.google.com/github/sdatkinson/neural-amp-modeler/blob/main/bin/train/easy_colab.ipynb).\n",
"\n",
"🔶**Before you run**🔶\n",
"\n",
"Make sure to get a GPU! (From the upper-left menu, click Runtime->Change runtime type->Select \"GPU\" from the \"Hardware accelerator dropdown menu)\n",
"\n",
"⚠**Warning**⚠\n",
"\n",
"Google Colab GPU instances only last for 12 hours.\n",
"Plan your training accordingly!\n",
"\n",
"## Steps:\n",
"1. Get your data\n",
"2. Installation\n",
"3. Enter metadata\n",
"4. Train!\n",
"5. Check the results and download your model"
"Make sure to get a GPU! (From the upper-left menu, click Runtime->Change runtime type->Select \"GPU\" from the \"Hardware accelerator dropdown menu)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "5CQleTk7GJV8"
},
"source": [
"## Step 1: Get data\n",
"We're gonna need data. \"Easy mode\" takes out a lot of the guesswork.\n",
"\n",
"### Step 1.1: Download the capture signal\n",
"\"Easy mode\" uses a pre-crafted \"capture signal\".\n",
"Download it here: [v3_0_0.wav](https://drive.google.com/file/d/1Pgf8PdE0rKB1TD4TRPKbpNo1ByR3IOm9/view?usp=drive_link).\n",
"\n",
"### Step 1.2 Reamp your gear\n",
"Then reamp the gear you want to model using it. Save that reamp as \"output.wav\".\n",
"**Please use 48kHz, 24-bit, mono.** We'll support other sample rates etc in the future; sit tight!\n",
"\n",
"### Step 1.3: upload!\n",
"Upload the input (DI) and output (amped) files you want to use by clicking the Folder icon on the left ⬅ and then clicking the upload icon."
"* **Download the reamp signal.** Here: [v3_0_0.wav](https://drive.google.com/file/d/1Pgf8PdE0rKB1TD4TRPKbpNo1ByR3IOm9/view?usp=drive_link).\n",
"* **Reamp your gear.** Then reamp the gear you want to model using it. Save that reamp as \"output.wav\". *Note: Use 48kHz, 24-bit, mono.* For other sample rates, use [the CLI trainer](https://github.com/sdatkinson/neural-amp-modeler).\n",
"* **Upload your files.** Upload the input (DI) and output (amped) files you want to use by clicking the Folder icon on the left ⬅ and then clicking the upload icon or by dragging the files into the panel."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "2g_4GtFuGlO8"
},
"source": [
"## Step 2: Installation\n",
"Install `nam` into this Colab instance by running the next cell (hover over and click the play button that appears in the upper-left corner):"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "vYQIpWr5EYRb"
},
"outputs": [],
"source": [
"!pip install neural-amp-modeler\n",
"# Hint: use the next line instead for the very latest!\n",
"# !pip install git+https://github.com/sdatkinson/neural-amp-modeler.git@main\n",
"\n",
"from nam.train.colab import run as _run\n",
"run = _run\n",
"%load_ext tensorboard"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "7tRCyI_YjZjj"
},
"source": [
"## Step 3: Enter metadata\n",
"Tell us about what you're modeling!"
"## Step 2: Train!\n",
"Configure your training run below, then hit the Play button to start training!\n",
"\n",
"🕙NOTE: At default settings, training will take just over 10 minutes.🕙"
]
},
{
Expand All @@ -100,95 +48,76 @@
},
"outputs": [],
"source": [
"try:\n",
" import nam\n",
"except ImportError as e:\n",
" !pip install neural-amp-modeler\n",
" # Hint: use the next line instead for the very latest!\n",
" # !pip install git+https://github.com/sdatkinson/neural-amp-modeler.git@main\n",
"\n",
"from nam.train.colab import run\n",
"from nam.models.metadata import GearType, ToneType, UserMetadata\n",
"\n",
"%load_ext tensorboard\n",
"\n",
"from functools import partial\n",
"\n",
"import ipywidgets as widgets\n",
"from nam.models.metadata import GearType, ToneType, UserMetadata\n",
"#@markdown NAM name\n",
"\n",
"# NOTE: Enums need to be handled carefully since the values need to be supplied literally here!\n",
"\n",
"#@markdown # Training parameters\n",
"epochs = 100 #@param {type: \"number\"}\n",
"architecture = \"standard\" #@param [\"standard\", \"lite\", \"feather\", \"nano\"] {type: \"string\"}\n",
"fit_cab = False #@param {type: \"boolean\"}\n",
"ignore_checks = False #@param {type: \"boolean\"}\n",
"\n",
"#@markdown # Metadata\n",
"use_metadata = False #@param {type: \"boolean\"}\n",
"name = \"My model\" #@param {type:\"string\"}\n",
"#@markdown Modeled by:\n",
"modeled_by = \"Your name\" #@param {type:\"string\"}\n",
"#@markdown Gear make:\n",
"gear_make = \"GearCo\" #@param {type:\"string\"}\n",
"#@markdown Gear model:\n",
"gear_model = \"GearAmp\" #@param {type:\"string\"}\n",
"#@markdown Gear type:\n",
"# This needs to be a literal. You need to change it by hand if you change the enum!\n",
"gear_type = \"Pick from: amp, pedal, pedal_amp, amp_cab, amp_pedal_cab, preamp, studio\" #@param {type:\"string\"}\n",
"#@markdown Tone type:\n",
"tone_type = \"Pick from: clean, overdrive, crunch, hi_gain, fuzz\" #@param {type:\"string\"}\n",
"gear_model = \"GearName\" #@param {type:\"string\"}\n",
"gear_type = \"pedal\" #@param [\"amp\", \"pedal\", \"pedal_amp\", \"amp_cab\", \"amp_pedal_cab\", \"preamp\", \"studio\"] {type:\"string\"}\n",
"tone_type = \"overdrive\" #@param [\"clean\", \"overdrive\", \"crunch\", \"hi_gain\", \"fuzz\"] {type:\"string\"}\n",
"\n",
"def _verbose_enum(E, val):\n",
" try:\n",
" return E(val)\n",
" except ValueError as e:\n",
" raise ValueError(\n",
" str(e) \n",
" + \"\\nValid choices are: \" \n",
" str(e)\n",
" + \"\\nValid choices are: \"\n",
" + \", \".join(list(x.value for x in E))\n",
" )\n",
"\n",
"user_metadata = UserMetadata(\n",
" name=name, \n",
" modeled_by=modeled_by, \n",
" gear_make=gear_make, \n",
" gear_model=gear_model, \n",
" gear_type=_verbose_enum(GearType, gear_type.lower()), \n",
"user_metadata = None if not use_metadata else UserMetadata(\n",
" name=name,\n",
" modeled_by=modeled_by,\n",
" gear_make=gear_make,\n",
" gear_model=gear_model,\n",
" gear_type=_verbose_enum(GearType, gear_type.lower()),\n",
" tone_type=_verbose_enum(ToneType, tone_type.lower())\n",
")\n",
"run = partial(_run, user_metadata=user_metadata)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "WVkBZg3-jZjl"
},
"source": [
"## Step 4: Train!\n",
"Here we go!\n",
"\n",
"🕙Training will go through 100 epochs and take just over 10 minutes.🕙\n",
"run_partial = partial(run, user_metadata=user_metadata)\n",
"\n",
"If you want a better model, you can try training for more \"**epochs**\"--just put in a \n",
"different number before hitting go!\n",
"\n",
"\"**architecture**\" selects from several presets for the size of the network. This trades off\n",
"modeling quality for how expensive the resulting model will be to run.\n",
"\n",
" \"**lite**\" models will run approximately **1.5 times** faster than \"**standard**\".\n",
"\n",
" \"**feather**\" models will run more than **2 times** faster than \"**standard**\".\n",
"\n",
" \"**nano**\" models will run about **2.5 times** faster than \"**standard**\".\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "xOzo3NxqjZjl"
},
"outputs": [],
"source": [
"%tensorboard --logdir /content/lightning_logs\n",
"run(\n",
" epochs=100,\n",
" architecture=\"standard\", # standard, lite, feather, nano\n",
" fit_cab=False, # Change me to True for full-rig modeling!\n",
" ignore_checks=False # Change to True to train anyways with potentially bad data\n",
" epochs=epochs,\n",
" architecture=architecture,\n",
" fit_cab=fit_cab, # Change me to True for full-rig modeling!\n",
" ignore_checks=ignore_checks, # Change to True to train anyways with potentially bad data\n",
" user_metadata=user_metadata\n",
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "823KJ_L0Rchp"
},
"source": [
"## Step 5: Check the results and download your model\n",
"## Step 3: Check the results and download your model\n",
"We're done!\n",
"\n",
"Have a look at the plot above to see how your model compares to the real gear you're modeling.\n",
Expand Down Expand Up @@ -233,4 +162,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}