Created using Colaboratory

This commit is contained in:
Eloi Moliner Juanpere 2022-01-20 17:14:53 +02:00
parent f88e6259fa
commit ab94cf7c34

View File

@ -1,15 +1,5 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/eloimoliner/denoising-historical-recordings/blob/colab/colab/demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
@ -21,130 +11,34 @@
"id": "jbe_aWYkjWRH"
},
{
"cell_type": "code",
"execution_count": 1,
"id": "dd70762d",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "dd70762d",
"outputId": "24457550-e127-4d73-db47-297147b68f09"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Cloning into 'denoising-historical-recordings'...\n",
"remote: Enumerating objects: 181, done.\u001b[K\n",
"remote: Counting objects: 100% (181/181), done.\u001b[K\n",
"remote: Compressing objects: 100% (157/157), done.\u001b[K\n",
"remote: Total 181 (delta 64), reused 98 (delta 16), pack-reused 0\u001b[K\n",
"Receiving objects: 100% (181/181), 104.80 KiB | 17.47 MiB/s, done.\n",
"Resolving deltas: 100% (64/64), done.\n",
"--2022-01-20 14:40:36-- https://github.com/eloimoliner/denoising-historical-recordings/releases/download/v0.0/checkpoint.zip\n",
"Resolving github.com (github.com)... 140.82.112.3\n",
"Connecting to github.com (github.com)|140.82.112.3|:443... connected.\n",
"HTTP request sent, awaiting response... 302 Found\n",
"Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/401385223/354cec4e-d8be-4126-8b32-9e6509bca537?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220120%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220120T144036Z&X-Amz-Expires=300&X-Amz-Signature=1cf02e4ae397a518db9da71aad3dfc7dcb844c520bbfc49398ca6a54171ad637&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=401385223&response-content-disposition=attachment%3B%20filename%3Dcheckpoint.zip&response-content-type=application%2Foctet-stream [following]\n",
"--2022-01-20 14:40:36-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/401385223/354cec4e-d8be-4126-8b32-9e6509bca537?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220120%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220120T144036Z&X-Amz-Expires=300&X-Amz-Signature=1cf02e4ae397a518db9da71aad3dfc7dcb844c520bbfc49398ca6a54171ad637&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=401385223&response-content-disposition=attachment%3B%20filename%3Dcheckpoint.zip&response-content-type=application%2Foctet-stream\n",
"Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...\n",
"Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 264031940 (252M) [application/octet-stream]\n",
"Saving to: checkpoint.zip\n",
"\n",
"checkpoint.zip 100%[===================>] 251.80M 215MB/s in 1.2s \n",
"\n",
"2022-01-20 14:40:38 (215 MB/s) - checkpoint.zip saved [264031940/264031940]\n",
"\n",
"Archive: checkpoint.zip\n",
" inflating: denoising-historical-recordings/experiments/trained_model/checkpoint \n",
" inflating: denoising-historical-recordings/experiments/trained_model/checkpoint.data-00000-of-00001 \n",
" inflating: denoising-historical-recordings/experiments/trained_model/checkpoint.index \n"
]
}
],
"cell_type": "markdown",
"source": [
"### Instructions for running:\n",
"\n",
"* Make sure to use a GPU runtime, click: __Runtime >> Change Runtime Type >> GPU__\n",
"* Press ▶️ on the left of each of the cells\n",
"* View the code: Double-click any of the cells\n",
"* Hide the code: Double click the right side of the cell\n"
],
"metadata": {
"id": "8UON6ncSApA9"
},
"id": "8UON6ncSApA9"
},
{
"cell_type": "code",
"source": [
"#@title #Install and Import\n",
"\n",
"#@markdown Installing the required data and dependencies. This step might take some minutes\n",
"\n",
"#download the files\n",
"! git clone https://github.com/eloimoliner/denoising-historical-recordings.git\n",
"! wget https://github.com/eloimoliner/denoising-historical-recordings/releases/download/v0.0/checkpoint.zip\n",
"! unzip checkpoint.zip -d denoising-historical-recordings/experiments/trained_model/"
]
},
{
"cell_type": "code",
"source": [
"! unzip checkpoint.zip -d denoising-historical-recordings/experiments/trained_model/\n",
"\n",
"%cd denoising-historical-recordings\n",
"\n",
"%cd denoising-historical-recordings"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "HmHRpa5eloy2",
"outputId": "8666da99-94e0-4ed2-afca-f9e31b37c84c"
},
"id": "HmHRpa5eloy2",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/denoising-historical-recordings\n"
]
}
]
},
{
"cell_type": "code",
"source": [
""
],
"metadata": {
"id": "gvd6KZkTlyhR"
},
"id": "gvd6KZkTlyhR",
"execution_count": 12,
"outputs": []
},
{
"cell_type": "code",
"source": [
""
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "nmic9hVzmSj6",
"outputId": "4d1a91d8-e994-48d3-d27b-f3c0b933b60e"
},
"id": "nmic9hVzmSj6",
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting hydra-core==0.11.3\n",
" Downloading hydra_core-0.11.3-py3-none-any.whl (72 kB)\n",
"\u001b[?25l\r\u001b[K |████▌ | 10 kB 34.0 MB/s eta 0:00:01\r\u001b[K |█████████ | 20 kB 38.2 MB/s eta 0:00:01\r\u001b[K |█████████████▋ | 30 kB 43.5 MB/s eta 0:00:01\r\u001b[K |██████████████████▏ | 40 kB 47.4 MB/s eta 0:00:01\r\u001b[K |██████████████████████▊ | 51 kB 33.6 MB/s eta 0:00:01\r\u001b[K |███████████████████████████▎ | 61 kB 36.8 MB/s eta 0:00:01\r\u001b[K |███████████████████████████████▉| 71 kB 27.7 MB/s eta 0:00:01\r\u001b[K |████████████████████████████████| 72 kB 649 kB/s \n",
"\u001b[?25hCollecting omegaconf<1.5,>=1.4\n",
" Downloading omegaconf-1.4.1-py3-none-any.whl (14 kB)\n",
"Requirement already satisfied: PyYAML in /usr/local/lib/python3.7/dist-packages (from omegaconf<1.5,>=1.4->hydra-core==0.11.3) (3.13)\n",
"Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from omegaconf<1.5,>=1.4->hydra-core==0.11.3) (1.15.0)\n",
"Installing collected packages: omegaconf, hydra-core\n",
"Successfully installed hydra-core-0.11.3 omegaconf-1.4.1\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"#install dependencies\n",
"! pip install hydra-core==0.11.3\n",
"\n",
@ -287,6 +181,7 @@
" return denoised_data"
],
"metadata": {
"cellView": "form",
"id": "TQBDTmO4mUBx"
},
"id": "TQBDTmO4mUBx",
@ -296,6 +191,9 @@
{
"cell_type": "code",
"source": [
"#@title #Upload file to denoise\n",
"\n",
"#@markdown Execute this cell to upload a single audio recording you would like to denoise (accepted extensions: .wav, .flac, .mp3)\n",
"from google.colab import files\n",
"uploaded=files.upload()"
],
@ -318,6 +216,7 @@
"base_uri": "https://localhost:8080/",
"height": 72
},
"cellView": "form",
"id": "50Kmdy6AtbhW",
"outputId": "2d05860c-536d-45f8-92b4-d2ba6f5a54c5"
},
@ -355,6 +254,9 @@
{
"cell_type": "code",
"source": [
"#@title #Denoise\n",
"\n",
"#@markdown Execute this cell to denoise the uploaded file\n",
"for fn in uploaded.keys():\n",
" print('Denoising uploaded file \"{name}\"'.format(\n",
" name=fn))\n",
@ -367,6 +269,7 @@
"colab": {
"base_uri": "https://localhost:8080/"
},
"cellView": "form",
"id": "0po6zpvrylc2",
"outputId": "173f5355-2939-41fe-c702-591aa752fc7e"
},
@ -393,7 +296,9 @@
{
"cell_type": "code",
"source": [
"#@title #Download\n",
"\n",
"#@markdown Execute this cell to download the denoised recording\n",
"files.download(wav_output_name)"
],
"metadata": {
@ -401,6 +306,7 @@
"base_uri": "https://localhost:8080/",
"height": 17
},
"cellView": "form",
"id": "3tEshWBezYvf",
"outputId": "54588c26-0b3c-42bf-aca2-8316ab54603f"
},
@ -506,8 +412,7 @@
},
"colab": {
"name": "demo.ipynb",
"provenance": [],
"include_colab_link": true
"provenance": []
},
"accelerator": "GPU"
},