From e3e766c5ca11f893444d2f7c04b1b1df8e749c32 Mon Sep 17 00:00:00 2001 From: Matthew Tancik Date: Mon, 31 Oct 2022 10:22:25 -0700 Subject: [PATCH] Update colab links to use repo colab (#866) --- README.md | 2 +- colab/demo.ipynb | 337 +++++++++++++++-------------- docs/_templates/sidebar/brand.html | 55 +++++ docs/index.md | 1 - docs/quickstart/google_colab.md | 3 - 5 files changed, 228 insertions(+), 170 deletions(-) delete mode 100644 docs/quickstart/google_colab.md diff --git a/README.md b/README.md index 21162926b..532d04eca 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ viewer - + colab

diff --git a/colab/demo.ipynb b/colab/demo.ipynb index 86e286caa..1dceefaa6 100644 --- a/colab/demo.ipynb +++ b/colab/demo.ipynb @@ -1,35 +1,20 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "collapsed_sections": [], - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - }, - "accelerator": "GPU", - "gpuClass": "standard" - }, "cells": [ { "cell_type": "markdown", "metadata": { - "id": "view-in-github", - "colab_type": "text" + "colab_type": "text", + "id": "view-in-github" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", + "metadata": { + "id": "SiiXJ7K_fePG" + }, "source": [ "

\n", " \n", @@ -50,13 +35,13 @@ "\\\\\n", "\n", "Credit to [NeX](https://nex-mpi.github.io/) for Google Colab format." - ], - "metadata": { - "id": "SiiXJ7K_fePG" - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "Yyx5h6kz5ga7" + }, "source": [ "## Frequently Asked Questions\n", "\n", @@ -70,32 +55,22 @@ "\n", "* **Other problems?**\n", " * Feel free to create an issue on our [GitHub repo](https://github.com/nerfstudio-project/nerfstudio).\n" - ], - "metadata": { - "id": "Yyx5h6kz5ga7" - } + ] }, { "cell_type": "code", - "source": [ - "#@title # Install Conda (requires runtime restart) { vertical-output: true, display-mode: \"form\" }\n", - "\n", - "!pip install -q condacolab\n", - "import condacolab\n", - "condacolab.install()" - ], + "execution_count": null, "metadata": { - "id": "RGr33zHaHak0", "colab": { "base_uri": "https://localhost:8080/" }, + "id": "RGr33zHaHak0", "outputId": "86df0e7f-35fe-4b79-8c0e-83692d42b124" }, - "execution_count": null, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "⏬ Downloading https://github.com/jaimergp/miniforge/releases/latest/download/Mambaforge-colab-Linux-x86_64.sh...\n", "📦 Installing...\n", @@ -105,10 +80,22 @@ "🔁 Restarting kernel...\n" ] } + ], + "source": [ + "#@title # Install Conda (requires runtime restart) { vertical-output: true, display-mode: \"form\" }\n", + "\n", + "!pip install -q condacolab\n", + "import condacolab\n", + "condacolab.install()" ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "9oyLHl8QfYwP" + }, + "outputs": [], "source": [ "#@title # Install Nerfstudio and Dependencies (~10 min) { vertical-output: true, display-mode: \"form\" }\n", "\n", @@ -128,15 +115,33 @@ "# Install nerfstudio\n", "%cd /content/\n", "!pip install nerfstudio" - ], - "metadata": { - "id": "9oyLHl8QfYwP" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "msVLprI4gRA4", + "outputId": "c5eb5997-37d9-4c9f-a3d2-7b67f4b6d346" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/content\n", + "Downloading...\n", + "From: https://drive.google.com/uc?id=1dmjWGXlJnUxwosN6MVooCDQe970PkD-1\n", + "To: /content/data/nerfstudio/poster.zip\n", + "100% 750M/750M [00:03<00:00, 218MB/s]\n", + "\u001b[0m" + ] + } + ], "source": [ "#@markdown

Downloading Data

\n", "#@markdown

Pick the preset scene or upload your own images/video

\n", @@ -175,33 +180,31 @@ " !ns-process-data video --data $video_path --output-dir /content/data/nerfstudio/custom_data/\n", "\n", " scene = \"custom_data\"" - ], - "metadata": { - "id": "msVLprI4gRA4", - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "c5eb5997-37d9-4c9f-a3d2-7b67f4b6d346" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "/content\n", - "Downloading...\n", - "From: https://drive.google.com/uc?id=1dmjWGXlJnUxwosN6MVooCDQe970PkD-1\n", - "To: /content/data/nerfstudio/poster.zip\n", - "100% 750M/750M [00:03<00:00, 218MB/s]\n", - "\u001b[0m" - ] - } ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Eju-3p2hjcB2", + "outputId": "c9ff081c-2436-44c6-d292-f22dc3ef78b5" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/content\n", + "\u001b[K\u001b[?25h/tools/node/bin/lt -> /tools/node/lib/node_modules/localtunnel/bin/lt.js\n", + "+ localtunnel@2.0.2\n", + "added 22 packages from 22 contributors in 1.536s\n" + ] + } + ], "source": [ "#@title # Set Up Viewer\n", "\n", @@ -214,31 +217,51 @@ "# Tunnel port 7007, the default for\n", "!rm url.txt 2> /dev/null\n", "get_ipython().system_raw('lt --port 7007 >> url.txt 2>&1 &')" - ], - "metadata": { - "id": "Eju-3p2hjcB2", - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "c9ff081c-2436-44c6-d292-f22dc3ef78b5" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "/content\n", - "\u001b[K\u001b[?25h/tools/node/bin/lt -> /tools/node/lib/node_modules/localtunnel/bin/lt.js\n", - "+ localtunnel@2.0.2\n", - "added 22 packages from 22 contributors in 1.536s\n" - ] - } ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 857 + }, + "id": "VoKDxqEcjmfC", + "outputId": "b966821b-7d18-43ee-ceb3-724ac2d0c022" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "https://viewer.nerf.studio/?websocket_url=wss://good-ways-ask-34-83-255-230.loca.lt\n", + "You may need to click Refresh Page after you start training!\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#@title # Start Viewer\n", "\n", @@ -254,101 +277,38 @@ "print(\"You may need to click Refresh Page after you start training!\")\n", "from IPython import display\n", "display.IFrame(src=url, height=800, width=\"100%\")" - ], - "metadata": { - "id": "VoKDxqEcjmfC", - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 857 - }, - "outputId": "b966821b-7d18-43ee-ceb3-724ac2d0c022" - }, - "execution_count": null, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "https://viewer.nerf.studio/?websocket_url=wss://good-ways-ask-34-83-255-230.loca.lt\n", - "You may need to click Refresh Page after you start training!\n" - ] - }, - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "" - ], - "text/html": [ - "\n", - " \n", - " " - ] - }, - "metadata": {}, - "execution_count": 4 - } ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "m_N8_cLfjoXD" + }, + "outputs": [], "source": [ "#@title # Start Training { vertical-output: true }\n", "\n", "%cd /content\n", "!ns-train nerfacto --viewer.websocket-port 7007 nerfstudio-data --data data/nerfstudio/$scene --downscale-factor 4" - ], - "metadata": { - "id": "m_N8_cLfjoXD", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", - "source": [ - "#@title # Render Video { vertical-output: true }\n", - "#@markdown

Export the camera path from within the viewer, then run this cell.

\n", - "#@markdown
The rendered video should be at renders/output.mp4!
\n", - "\n", - "\n", - "base_dir = \"/content/outputs/data-nerfstudio-\" + scene + \"/nerfacto/\"\n", - "training_run_dir = base_dir + os.listdir(base_dir)[0]\n", - "\n", - "from IPython.core.display import display, HTML\n", - "display(HTML('

Upload the camera path JSON.

'))\n", - "%cd $training_run_dir\n", - "uploaded = files.upload()\n", - "uploaded_camera_path_filename = list(uploaded.keys())[0]\n", - "\n", - "config_filename = training_run_dir + \"/config.yml\"\n", - "camera_path_filename = training_run_dir + \"/\" + uploaded_camera_path_filename\n", - "camera_path_filename = camera_path_filename.replace(\" \", \"\\\\ \").replace(\"(\", \"\\\\(\").replace(\")\", \"\\\\)\")\n", - "\n", - "%cd /content/\n", - "!ns-render --load-config $config_filename --traj filename --camera-path-filename $camera_path_filename --output-path renders/output.mp4" - ], + "execution_count": null, "metadata": { - "id": "WGt8ukG6Htg3", + "cellView": "form", "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "fa946890-c7d8-4e46-a54e-7231bc5a2059", - "cellView": "form" + "id": "WGt8ukG6Htg3", + "outputId": "fa946890-c7d8-4e46-a54e-7231bc5a2059" }, - "execution_count": null, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "\u001b[2;36m[19:48:48]\u001b[0m\u001b[2;36m \u001b[0mSkipping \u001b[1;36m0\u001b[0m files in dataset split train. \u001b]8;id=527413;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py\u001b\\\u001b[2mnerfstudio_dataparser.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=243595;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py#91\u001b\\\u001b[2m91\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[2;36m \u001b[0m\u001b[2;36m \u001b[0mSkipping \u001b[1;36m0\u001b[0m files in dataset split test. \u001b]8;id=109270;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py\u001b\\\u001b[2mnerfstudio_dataparser.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=464675;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py#91\u001b\\\u001b[2m91\u001b[0m\u001b]8;;\u001b\\\n", @@ -371,7 +331,54 @@ "\u001b[0m" ] } + ], + "source": [ + "#@title # Render Video { vertical-output: true }\n", + "#@markdown

Export the camera path from within the viewer, then run this cell.

\n", + "#@markdown
The rendered video should be at renders/output.mp4!
\n", + "\n", + "\n", + "base_dir = \"/content/outputs/data-nerfstudio-\" + scene + \"/nerfacto/\"\n", + "training_run_dir = base_dir + os.listdir(base_dir)[0]\n", + "\n", + "from IPython.core.display import display, HTML\n", + "display(HTML('

Upload the camera path JSON.

'))\n", + "%cd $training_run_dir\n", + "uploaded = files.upload()\n", + "uploaded_camera_path_filename = list(uploaded.keys())[0]\n", + "\n", + "config_filename = training_run_dir + \"/config.yml\"\n", + "camera_path_filename = training_run_dir + \"/\" + uploaded_camera_path_filename\n", + "camera_path_filename = camera_path_filename.replace(\" \", \"\\\\ \").replace(\"(\", \"\\\\(\").replace(\")\", \"\\\\)\")\n", + "\n", + "%cd /content/\n", + "!ns-render --load-config $config_filename --traj filename --camera-path-filename $camera_path_filename --output-path renders/output.mp4" ] } - ] + ], + "metadata": { + "accelerator": "GPU", + "colab": { + "collapsed_sections": [], + "include_colab_link": true, + "provenance": [] + }, + "gpuClass": "standard", + "kernelspec": { + "display_name": "Python 3.8.12 ('nerfactory')", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.8.12" + }, + "vscode": { + "interpreter": { + "hash": "34c28001ff35fb390494047002768a8182dcf55b1b11415165e62ea61557ab83" + } + } + }, + "nbformat": 4, + "nbformat_minor": 0 } diff --git a/docs/_templates/sidebar/brand.html b/docs/_templates/sidebar/brand.html index 14772296b..7a0140a98 100644 --- a/docs/_templates/sidebar/brand.html +++ b/docs/_templates/sidebar/brand.html @@ -44,4 +44,59 @@ going well. :) -#} > Github +
+ + + + + + + + + + +  colab diff --git a/docs/index.md b/docs/index.md index c6bbb80c8..faffde5c9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -50,7 +50,6 @@ quickstart/installation quickstart/first_nerf quickstart/custom_dataset quickstart/viewer_quickstart -quickstart/google_colab Contributing ``` diff --git a/docs/quickstart/google_colab.md b/docs/quickstart/google_colab.md deleted file mode 100644 index f953d7f63..000000000 --- a/docs/quickstart/google_colab.md +++ /dev/null @@ -1,3 +0,0 @@ -# Google Colab - -Nerfstudio works in Google Colab using their hosted GPUs! Here is [the link](https://colab.research.google.com/drive/13ZUOVo9N4fjZcoS_R9N0BsYa2kV6ywuq?usp=sharing). Make a copy of this file and go from there!