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

Add NerfStudio examples #167

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "SiiXJ7K_fePG"
},
"source": [
"<img src=\"https://cdn.comet.ml/img/notebook_logo.png\">\n",
"\n",
"<img height=40px align=\"right\" src=\"https://docs.nerf.studio/en/latest/_images/logo.png\">\n",
"\n",
"\n",
"This notebook shows to use Comet with Nerfstudio a library that provides a simple API for a simplified end-to-end process of creating, training, and testing NeRFs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9oyLHl8QfYwP"
},
"outputs": [],
"source": [
"%cd /content/\n",
"%pip install --upgrade pip\n",
"%pip install -U torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "dqnlofRu10Ya"
},
"outputs": [],
"source": [
"# Installing TinyCuda\n",
"%cd /content/\n",
"!gdown \"https://drive.google.com/u/1/uc?id=1-7x7qQfB7bIw2zV4Lr6-yhvMpjXC84Q5&confirm=t\"\n",
"!pip install tinycudann-1.7-cp310-cp310-linux_x86_64.whl"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "OMHbnUxO11a4"
},
"outputs": [],
"source": [
"# Install nerfstudio\n",
"%cd /content/\n",
"!pip install git+https://github.com/nerfstudio-project/nerfstudio"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "zuN8Ya9yuULS"
},
"outputs": [],
"source": [
"# Download the dataset which is needed for the viewer\n",
"%cd /content/\n",
"!ns-download-data sitcoms3d"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "EJBXMB-fF-rB"
},
"outputs": [],
"source": [
"import comet_ml\n",
"\n",
"comet_ml.init()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "XfVVcrnr-unc"
},
"outputs": [],
"source": [
"import json\n",
"import comet_ml\n",
"\n",
"api = comet_ml.API()\n",
"\n",
"# Retrieve a model from the training experiment\n",
"EXPERIMENT_KEY = \"e2532a362cbc42d9b8d41c2510619707\"\n",
"MODEL_NAME = \"nerfstudio-model\"\n",
"\n",
"api_experiment = api.get_experiment_by_key(EXPERIMENT_KEY)\n",
"\n",
"# Retrieve the expected nerfstudio directory structure\n",
"model_assets = api_experiment.get_model_asset_list(MODEL_NAME)\n",
"metadata = model_assets[-1][\"metadata\"]\n",
"output_dir = json.loads(metadata)[\"nerfstudio_project_dir\"]\n",
"\n",
"api_experiment.download_model(MODEL_NAME, output_path=output_dir)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"background_save": true
},
"id": "eJdbgqA4_hn7"
},
"outputs": [],
"source": [
"# Start the viewer\n",
"!ns-viewer --load-config \"$output_dir/config.yml\" --vis \"viewer\" --viewer.make-share-url True"
]
}
],
"metadata": {
"colab": {
"provenance": [],
"gpuType": "T4"
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.8.13"
},
"vscode": {
"interpreter": {
"hash": "c59f626636933ef1dc834fb3684b382f705301c5306cf8436d2da634c2289783"
}
},
"accelerator": "GPU"
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading
Loading