From 2b7a2202da94a58ab08dcce0e4a97d67ef968bfc Mon Sep 17 00:00:00 2001 From: Atanu Sarkar <34891206+mratanusarkar@users.noreply.github.com> Date: Wed, 6 Sep 2023 01:00:47 +0530 Subject: [PATCH 1/3] add: dynamic range and better cmap --- colabs/audiocraft/AudioCraft_MusicGen.ipynb | 460 ++++++++++++++++++-- 1 file changed, 425 insertions(+), 35 deletions(-) diff --git a/colabs/audiocraft/AudioCraft_MusicGen.ipynb b/colabs/audiocraft/AudioCraft_MusicGen.ipynb index 65186293..f815b720 100644 --- a/colabs/audiocraft/AudioCraft_MusicGen.ipynb +++ b/colabs/audiocraft/AudioCraft_MusicGen.ipynb @@ -2,14 +2,9 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 1000 - }, - "id": "EZU3hg4B1om6", - "outputId": "1512f321-698c-4d01-e8d9-6d9577eee7e1" + "id": "EZU3hg4B1om6" }, "outputs": [], "source": [ @@ -18,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "id": "RerQaiZt14r8" }, @@ -42,16 +37,84 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/", - "height": 122 + "height": 121 }, "id": "3MTX8GoE7AzN", - "outputId": "33e92860-9ff9-4923-87a5-66c2d89e5f22" + "outputId": "b810614d-54e4-4b1c-ce8b-dc3d8b3faed0" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mmratanusarkar\u001b[0m. Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "Tracking run with wandb version 0.15.9" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "Run data is saved locally in /content/wandb/run-20230905_192320-2nmhb0rf" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "Syncing run warm-dew-9 to Weights & Biases (docs)
" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + " View project at https://wandb.ai/mratanusarkar/audiocraft" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + " View run at https://wandb.ai/mratanusarkar/audiocraft/runs/2nmhb0rf" + ] + }, + "metadata": {} + } + ], "source": [ "# @title ## MusicGen Configs\n", "\n", @@ -117,15 +180,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "SfM8rhVX7ES9", - "outputId": "22fd7b60-ce23-4aac-86cf-5d5e0a712815" + "outputId": "de6bb1e2-b2bb-45e3-cae6-082f3421b69a" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [] + } + ], "source": [ "model = MusicGen.get_pretrained(config.model_name)\n", "model.set_generation_params(\n", @@ -150,51 +219,115 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "_n-1RthFVPYN" }, "outputs": [], "source": [ "def get_spectrogram(audio_file, output_file):\n", - " # Read the audio file\n", " sample_rate, samples = wavfile.read(audio_file)\n", - "\n", - " # Compute the spectrogram\n", " frequencies, times, Sxx = signal.spectrogram(samples, sample_rate)\n", + " log_Sxx = 10 * np.log10(Sxx + 1e-10)\n", "\n", - " # Create a figure and axis for plotting\n", - " fig, ax = plt.subplots()\n", + " vmin = np.percentile(log_Sxx, 5)\n", + " vmax = np.percentile(log_Sxx, 95)\n", "\n", - " # Plot the spectrogram\n", - " ax.pcolormesh(times, frequencies, 10 * np.log10(Sxx), shading='gouraud')\n", + " fig, ax = plt.subplots()\n", + " cmap = plt.get_cmap('magma')\n", "\n", - " # Remove axis, labels, and other decorations\n", + " ax.pcolormesh(times, frequencies, log_Sxx, shading='gouraud', cmap=cmap, vmin=vmin, vmax=vmax)\n", " ax.axis('off')\n", - " plt.subplots_adjust(left=0, right=1, top=1, bottom=0)\n", "\n", - " # Save the figure to a temporary buffer\n", + " plt.subplots_adjust(left=0, right=1, top=1, bottom=0)\n", " plt.savefig(output_file, format='png', bbox_inches='tight', pad_inches=0)\n", - "\n", - " # Close the plot\n", " plt.close()\n", "\n", - " # Return the image saved in the buffer\n", " return wandb.Image(output_file)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/", - "height": 140 + "height": 202, + "referenced_widgets": [ + "74bbecd023f9445ba0d0ed7bfe70eff0", + "460638f2e75940ab9bfbb8462c999578", + "14b96ae5b6b5474a9d6ff0f965a8254f", + "429dc8b5310848d9bdb80fa2d9b1a195", + "a83bab8c4015406ea684378707f06cf0", + "3eb0c1ee2c9a40fda4bc1857c8682065", + "18132d13b0fe4557bd3b2152359ba0ea", + "b46500e1c40542538622d7025bf797e7" + ] }, "id": "4fcOpiYx7Fqf", - "outputId": "4282158f-1170-4a3b-e514-a4f3916e3a7e" + "outputId": "8f6f48ea-090a-4c4a-96b1-dbc6e285abb2" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "CLIPPING /tmp/tmpwqlxlmtc/0 happening with proba (a bit of clipping is okay): 0.003078124951571226 maximum scale: 1.452661156654358\n", + "CLIPPING /tmp/tmpwqlxlmtc/1 happening with proba (a bit of clipping is okay): 1.5625000742147677e-05 maximum scale: 1.2949298620224\n", + "CLIPPING /tmp/tmpwqlxlmtc/2 happening with proba (a bit of clipping is okay): 0.00021875000675208867 maximum scale: 1.3656854629516602\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "Waiting for W&B process to finish... (success)." + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "VBox(children=(Label(value='5.349 MB of 5.349 MB uploaded (0.000 MB deduped)\\r'), FloatProgress(value=0.999964…" + ], + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "74bbecd023f9445ba0d0ed7bfe70eff0" + } + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + " View run warm-dew-9 at: https://wandb.ai/mratanusarkar/audiocraft/runs/2nmhb0rf
Synced 5 W&B file(s), 4 media file(s), 7 artifact file(s) and 0 other file(s)" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "Find logs at: ./wandb/run-20230905_192320-2nmhb0rf/logs" + ] + }, + "metadata": {} + } + ], "source": [ "temp_dir = TemporaryDirectory()\n", "wandb_table = wandb.Table(columns=[\"Prompt\", \"Audio\", \"Spectrogram\", \"Seed\"])\n", @@ -229,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "id": "7tYIL-auPawL" }, @@ -249,8 +382,265 @@ }, "language_info": { "name": "python" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "74bbecd023f9445ba0d0ed7bfe70eff0": { + "model_module": "@jupyter-widgets/controls", + "model_name": "VBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "VBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "VBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_460638f2e75940ab9bfbb8462c999578", + "IPY_MODEL_14b96ae5b6b5474a9d6ff0f965a8254f" + ], + "layout": "IPY_MODEL_429dc8b5310848d9bdb80fa2d9b1a195" + } + }, + "460638f2e75940ab9bfbb8462c999578": { + "model_module": "@jupyter-widgets/controls", + "model_name": "LabelModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "LabelModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "LabelView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_a83bab8c4015406ea684378707f06cf0", + "placeholder": "​", + "style": "IPY_MODEL_3eb0c1ee2c9a40fda4bc1857c8682065", + "value": "5.349 MB of 5.349 MB uploaded (0.000 MB deduped)\r" + } + }, + "14b96ae5b6b5474a9d6ff0f965a8254f": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_18132d13b0fe4557bd3b2152359ba0ea", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_b46500e1c40542538622d7025bf797e7", + "value": 0.9999641637896668 + } + }, + "429dc8b5310848d9bdb80fa2d9b1a195": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a83bab8c4015406ea684378707f06cf0": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "3eb0c1ee2c9a40fda4bc1857c8682065": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "18132d13b0fe4557bd3b2152359ba0ea": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "b46500e1c40542538622d7025bf797e7": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + } + } } }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file From 4ceb43cb2a06c36ebaa34b6bd1c5cd3dcfadbdc0 Mon Sep 17 00:00:00 2001 From: Atanu Sarkar <34891206+mratanusarkar@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:16:33 +0530 Subject: [PATCH 2/3] add: frequency axis scaling based on mean spectrum threshold --- colabs/audiocraft/AudioCraft_MusicGen.ipynb | 452 +------------------- 1 file changed, 23 insertions(+), 429 deletions(-) diff --git a/colabs/audiocraft/AudioCraft_MusicGen.ipynb b/colabs/audiocraft/AudioCraft_MusicGen.ipynb index f815b720..4ccb16ff 100644 --- a/colabs/audiocraft/AudioCraft_MusicGen.ipynb +++ b/colabs/audiocraft/AudioCraft_MusicGen.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "id": "EZU3hg4B1om6" }, @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "id": "RerQaiZt14r8" }, @@ -37,84 +37,11 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 121 - }, - "id": "3MTX8GoE7AzN", - "outputId": "b810614d-54e4-4b1c-ce8b-dc3d8b3faed0" + "id": "3MTX8GoE7AzN" }, - "outputs": [ - { - "output_type": "stream", - "name": "stderr", - "text": [ - "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mmratanusarkar\u001b[0m. Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n" - ] - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "Tracking run with wandb version 0.15.9" - ] - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "Run data is saved locally in /content/wandb/run-20230905_192320-2nmhb0rf" - ] - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "Syncing run warm-dew-9 to Weights & Biases (docs)
" - ] - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - " View project at https://wandb.ai/mratanusarkar/audiocraft" - ] - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - " View run at https://wandb.ai/mratanusarkar/audiocraft/runs/2nmhb0rf" - ] - }, - "metadata": {} - } - ], + "outputs": [], "source": [ "# @title ## MusicGen Configs\n", "\n", @@ -180,21 +107,11 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "SfM8rhVX7ES9", - "outputId": "de6bb1e2-b2bb-45e3-cae6-082f3421b69a" + "id": "SfM8rhVX7ES9" }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [] - } - ], + "outputs": [], "source": [ "model = MusicGen.get_pretrained(config.model_name)\n", "model.set_generation_params(\n", @@ -219,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "id": "_n-1RthFVPYN" }, @@ -228,16 +145,25 @@ "def get_spectrogram(audio_file, output_file):\n", " sample_rate, samples = wavfile.read(audio_file)\n", " frequencies, times, Sxx = signal.spectrogram(samples, sample_rate)\n", - " log_Sxx = 10 * np.log10(Sxx + 1e-10)\n", "\n", + " log_Sxx = 10 * np.log10(Sxx + 1e-10)\n", " vmin = np.percentile(log_Sxx, 5)\n", " vmax = np.percentile(log_Sxx, 95)\n", "\n", + " mean_spectrum = np.mean(log_Sxx, axis=1)\n", + " threshold_low = np.percentile(mean_spectrum, 5)\n", + " threshold_high = np.percentile(mean_spectrum, 95)\n", + "\n", + " freq_indices = np.where(mean_spectrum > threshold_low)\n", + " freq_min = 20\n", + " freq_max = frequencies[freq_indices].max()\n", + "\n", " fig, ax = plt.subplots()\n", " cmap = plt.get_cmap('magma')\n", "\n", " ax.pcolormesh(times, frequencies, log_Sxx, shading='gouraud', cmap=cmap, vmin=vmin, vmax=vmax)\n", " ax.axis('off')\n", + " ax.set_ylim([freq_min, freq_max])\n", "\n", " plt.subplots_adjust(left=0, right=1, top=1, bottom=0)\n", " plt.savefig(output_file, format='png', bbox_inches='tight', pad_inches=0)\n", @@ -248,86 +174,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 202, - "referenced_widgets": [ - "74bbecd023f9445ba0d0ed7bfe70eff0", - "460638f2e75940ab9bfbb8462c999578", - "14b96ae5b6b5474a9d6ff0f965a8254f", - "429dc8b5310848d9bdb80fa2d9b1a195", - "a83bab8c4015406ea684378707f06cf0", - "3eb0c1ee2c9a40fda4bc1857c8682065", - "18132d13b0fe4557bd3b2152359ba0ea", - "b46500e1c40542538622d7025bf797e7" - ] - }, - "id": "4fcOpiYx7Fqf", - "outputId": "8f6f48ea-090a-4c4a-96b1-dbc6e285abb2" + "id": "4fcOpiYx7Fqf" }, - "outputs": [ - { - "output_type": "stream", - "name": "stderr", - "text": [ - "CLIPPING /tmp/tmpwqlxlmtc/0 happening with proba (a bit of clipping is okay): 0.003078124951571226 maximum scale: 1.452661156654358\n", - "CLIPPING /tmp/tmpwqlxlmtc/1 happening with proba (a bit of clipping is okay): 1.5625000742147677e-05 maximum scale: 1.2949298620224\n", - "CLIPPING /tmp/tmpwqlxlmtc/2 happening with proba (a bit of clipping is okay): 0.00021875000675208867 maximum scale: 1.3656854629516602\n" - ] - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "Waiting for W&B process to finish... (success)." - ] - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "VBox(children=(Label(value='5.349 MB of 5.349 MB uploaded (0.000 MB deduped)\\r'), FloatProgress(value=0.999964…" - ], - "application/vnd.jupyter.widget-view+json": { - "version_major": 2, - "version_minor": 0, - "model_id": "74bbecd023f9445ba0d0ed7bfe70eff0" - } - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - " View run warm-dew-9 at: https://wandb.ai/mratanusarkar/audiocraft/runs/2nmhb0rf
Synced 5 W&B file(s), 4 media file(s), 7 artifact file(s) and 0 other file(s)" - ] - }, - "metadata": {} - }, - { - "output_type": "display_data", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "Find logs at: ./wandb/run-20230905_192320-2nmhb0rf/logs" - ] - }, - "metadata": {} - } - ], + "outputs": [], "source": [ "temp_dir = TemporaryDirectory()\n", "wandb_table = wandb.Table(columns=[\"Prompt\", \"Audio\", \"Spectrogram\", \"Seed\"])\n", @@ -362,7 +213,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "id": "7tYIL-auPawL" }, @@ -382,263 +233,6 @@ }, "language_info": { "name": "python" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "74bbecd023f9445ba0d0ed7bfe70eff0": { - "model_module": "@jupyter-widgets/controls", - "model_name": "VBoxModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "VBoxModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "VBoxView", - "box_style": "", - "children": [ - "IPY_MODEL_460638f2e75940ab9bfbb8462c999578", - "IPY_MODEL_14b96ae5b6b5474a9d6ff0f965a8254f" - ], - "layout": "IPY_MODEL_429dc8b5310848d9bdb80fa2d9b1a195" - } - }, - "460638f2e75940ab9bfbb8462c999578": { - "model_module": "@jupyter-widgets/controls", - "model_name": "LabelModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "LabelModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "LabelView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_a83bab8c4015406ea684378707f06cf0", - "placeholder": "​", - "style": "IPY_MODEL_3eb0c1ee2c9a40fda4bc1857c8682065", - "value": "5.349 MB of 5.349 MB uploaded (0.000 MB deduped)\r" - } - }, - "14b96ae5b6b5474a9d6ff0f965a8254f": { - "model_module": "@jupyter-widgets/controls", - "model_name": "FloatProgressModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "FloatProgressModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "ProgressView", - "bar_style": "", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_18132d13b0fe4557bd3b2152359ba0ea", - "max": 1, - "min": 0, - "orientation": "horizontal", - "style": "IPY_MODEL_b46500e1c40542538622d7025bf797e7", - "value": 0.9999641637896668 - } - }, - "429dc8b5310848d9bdb80fa2d9b1a195": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "a83bab8c4015406ea684378707f06cf0": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "3eb0c1ee2c9a40fda4bc1857c8682065": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" - } - }, - "18132d13b0fe4557bd3b2152359ba0ea": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_model_module": "@jupyter-widgets/base", - "_model_module_version": "1.2.0", - "_model_name": "LayoutModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "LayoutView", - "align_content": null, - "align_items": null, - "align_self": null, - "border": null, - "bottom": null, - "display": null, - "flex": null, - "flex_flow": null, - "grid_area": null, - "grid_auto_columns": null, - "grid_auto_flow": null, - "grid_auto_rows": null, - "grid_column": null, - "grid_gap": null, - "grid_row": null, - "grid_template_areas": null, - "grid_template_columns": null, - "grid_template_rows": null, - "height": null, - "justify_content": null, - "justify_items": null, - "left": null, - "margin": null, - "max_height": null, - "max_width": null, - "min_height": null, - "min_width": null, - "object_fit": null, - "object_position": null, - "order": null, - "overflow": null, - "overflow_x": null, - "overflow_y": null, - "padding": null, - "right": null, - "top": null, - "visibility": null, - "width": null - } - }, - "b46500e1c40542538622d7025bf797e7": { - "model_module": "@jupyter-widgets/controls", - "model_name": "ProgressStyleModel", - "model_module_version": "1.5.0", - "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "ProgressStyleModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/base", - "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "bar_color": null, - "description_width": "" - } - } - } } }, "nbformat": 4, From 144b166294b072a68e0fa381786cdc82d770e0fa Mon Sep 17 00:00:00 2001 From: Atanu Sarkar <34891206+mratanusarkar@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:20:21 +0530 Subject: [PATCH 3/3] chore: changed string quotes to " --- colabs/audiocraft/AudioCraft_MusicGen.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/colabs/audiocraft/AudioCraft_MusicGen.ipynb b/colabs/audiocraft/AudioCraft_MusicGen.ipynb index 4ccb16ff..134d7c91 100644 --- a/colabs/audiocraft/AudioCraft_MusicGen.ipynb +++ b/colabs/audiocraft/AudioCraft_MusicGen.ipynb @@ -159,14 +159,14 @@ " freq_max = frequencies[freq_indices].max()\n", "\n", " fig, ax = plt.subplots()\n", - " cmap = plt.get_cmap('magma')\n", + " cmap = plt.get_cmap(\"magma\")\n", "\n", - " ax.pcolormesh(times, frequencies, log_Sxx, shading='gouraud', cmap=cmap, vmin=vmin, vmax=vmax)\n", - " ax.axis('off')\n", + " ax.pcolormesh(times, frequencies, log_Sxx, shading=\"gouraud\", cmap=cmap, vmin=vmin, vmax=vmax)\n", + " ax.axis(\"off\")\n", " ax.set_ylim([freq_min, freq_max])\n", "\n", " plt.subplots_adjust(left=0, right=1, top=1, bottom=0)\n", - " plt.savefig(output_file, format='png', bbox_inches='tight', pad_inches=0)\n", + " plt.savefig(output_file, format=\"png\", bbox_inches=\"tight\", pad_inches=0)\n", " plt.close()\n", "\n", " return wandb.Image(output_file)"