mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-24 08:35:41 +08:00
Google Colab support with viewer (#747)
* allows bridge server to run on a different machine * added script * update version * starting docs * update docs and scripts * ngrok support * use tcp * moving webrtc outside bridge server. wop * lazy commit * lazy commit * running code. webrtc not working * lazy commit * better logic for webrtc connection * cleanup * todo comment * working webrtc * removed logging * fixing black * fix eslint * fix python version * fix readme * misc cleanup * small docs fix Co-authored-by: Ethan Weber <ethanweber@Ethans-MacBook-Pro.local>
This commit is contained in:
1 parent
a4755a1349
commit
d71c05f256
37 files changed
+324
-329
No files matched your search
@@ -29,7 +29,7 @@ from rich.console import Console
|
||||
from nerfstudio.configs import base_config as cfg
|
||||
from nerfstudio.pipelines.base_pipeline import Pipeline
|
||||
|
||||
console = Console(width=120)
|
||||
CONSOLE = Console(width=120)
|
||||
|
||||
|
||||
def eval_load_checkpoint(config: cfg.TrainerConfig, pipeline: Pipeline) -> Path:
|
||||
@@ -42,12 +42,12 @@ def eval_load_checkpoint(config: cfg.TrainerConfig, pipeline: Pipeline) -> Path:
|
||||
"""
|
||||
assert config.load_dir is not None
|
||||
if config.load_step is None:
|
||||
console.print("Loading latest checkpoint from load_dir")
|
||||
CONSOLE.print("Loading latest checkpoint from load_dir")
|
||||
# NOTE: this is specific to the checkpoint name format
|
||||
if not os.path.exists(config.load_dir):
|
||||
console.rule("Error", style="red")
|
||||
console.print(f"No checkpoint directory found at {config.load_dir}, ", justify="center")
|
||||
console.print(
|
||||
CONSOLE.rule("Error", style="red")
|
||||
CONSOLE.print(f"No checkpoint directory found at {config.load_dir}, ", justify="center")
|
||||
CONSOLE.print(
|
||||
"Please make sure the checkpoint exists, they should be generated periodically during training",
|
||||
justify="center",
|
||||
)
|
||||
@@ -59,7 +59,7 @@ def eval_load_checkpoint(config: cfg.TrainerConfig, pipeline: Pipeline) -> Path:
|
||||
assert load_path.exists(), f"Checkpoint {load_path} does not exist"
|
||||
loaded_state = torch.load(load_path, map_location="cpu")
|
||||
pipeline.load_pipeline(loaded_state["pipeline"])
|
||||
console.print(f":white_check_mark: Done loading checkpoint from {load_path}")
|
||||
CONSOLE.print(f":white_check_mark: Done loading checkpoint from {load_path}")
|
||||
return load_path
|
||||
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ import sys
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
console = Console(width=120)
|
||||
CONSOLE = Console(width=120)
|
||||
|
||||
|
||||
def check_ffmpeg_installed():
|
||||
"""Checks if ffmpeg is installed."""
|
||||
ffmpeg_path = shutil.which("ffmpeg")
|
||||
if ffmpeg_path is None:
|
||||
console.print("[bold red]Could not find ffmpeg. Please install ffmpeg.")
|
||||
CONSOLE.print("[bold red]Could not find ffmpeg. Please install ffmpeg.")
|
||||
print("See https://ffmpeg.org/download.html for installation instructions.")
|
||||
print("ffmpeg is only necessary if using videos as input.")
|
||||
sys.exit(1)
|
||||
@@ -36,6 +36,6 @@ def check_colmap_installed():
|
||||
"""Checks if colmap is installed."""
|
||||
colmap_path = shutil.which("colmap")
|
||||
if colmap_path is None:
|
||||
console.print("[bold red]Could not find COLMAP. Please install COLMAP.")
|
||||
CONSOLE.print("[bold red]Could not find COLMAP. Please install COLMAP.")
|
||||
print("See https://colmap.github.io/install.html for installation instructions.")
|
||||
sys.exit(1)
|
||||
@@ -18,19 +18,19 @@ from math import floor, log
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
console = Console(width=120)
|
||||
CONSOLE = Console(width=120)
|
||||
|
||||
|
||||
def print_tcnn_speed_warning(method_name: str):
|
||||
"""Prints a warning about the speed of the TCNN."""
|
||||
console.line()
|
||||
console.print(f"[bold yellow]WARNING: Using a slow implementation of {method_name}. ")
|
||||
console.print(
|
||||
CONSOLE.line()
|
||||
CONSOLE.print(f"[bold yellow]WARNING: Using a slow implementation of {method_name}. ")
|
||||
CONSOLE.print(
|
||||
"[bold yellow]:person_running: :person_running: "
|
||||
+ "Install tcnn for speedups :person_running: :person_running:"
|
||||
)
|
||||
console.print("[yellow]pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch")
|
||||
console.line()
|
||||
CONSOLE.print("[yellow]pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch")
|
||||
CONSOLE.line()
|
||||
|
||||
|
||||
def human_format(num):
|
||||
|
||||
@@ -17,10 +17,11 @@ Profiler base class and functionality
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import time
|
||||
from typing import Callable
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
from nerfstudio.configs import base_config as cfg
|
||||
from nerfstudio.utils import comms
|
||||
from nerfstudio.utils.decorators import (
|
||||
@@ -29,6 +30,8 @@ from nerfstudio.utils.decorators import (
|
||||
decorate_all,
|
||||
)
|
||||
|
||||
CONSOLE = Console(width=120)
|
||||
|
||||
PROFILER = []
|
||||
|
||||
|
||||
@@ -82,7 +85,7 @@ class Profiler:
|
||||
|
||||
def print_profile(self):
|
||||
"""helper to print out the profiler stats"""
|
||||
logging.info("Printing profiling stats, from longest to shortest duration in seconds")
|
||||
CONSOLE.print("Printing profiling stats, from longest to shortest duration in seconds")
|
||||
sorted_keys = sorted(
|
||||
self.profiler_dict.keys(),
|
||||
key=lambda k: self.profiler_dict[k]["val"],
|
||||
@@ -90,4 +93,4 @@ class Profiler:
|
||||
)
|
||||
for k in sorted_keys:
|
||||
val = f"{self.profiler_dict[k]['val']:0.4f}"
|
||||
print(f"{k:<20}: {val:<20}")
|
||||
CONSOLE.print(f"{k:<20}: {val:<20}")
|
||||
@@ -18,7 +18,6 @@ Generic Writer class
|
||||
from __future__ import annotations
|
||||
|
||||
import enum
|
||||
import logging
|
||||
from abc import abstractmethod
|
||||
from pathlib import Path
|
||||
from time import time
|
||||
@@ -26,7 +25,7 @@ from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import torch
|
||||
import wandb
|
||||
from rich import console
|
||||
from rich.console import Console
|
||||
from torch.utils.tensorboard import SummaryWriter
|
||||
from torchtyping import TensorType
|
||||
|
||||
@@ -34,8 +33,7 @@ from nerfstudio.configs import base_config as cfg
|
||||
from nerfstudio.utils.decorators import check_main_thread, decorate_all
|
||||
from nerfstudio.utils.printing import human_format
|
||||
|
||||
CONSOLE = console.Console()
|
||||
|
||||
CONSOLE = Console(width=120)
|
||||
to8b = lambda x: (255 * torch.clamp(x, min=0, max=1)).to(torch.uint8)
|
||||
EVENT_WRITERS = []
|
||||
EVENT_STORAGE = []
|
||||
@@ -181,7 +179,7 @@ def setup_local_writer(config: cfg.LoggingConfig, max_iter: int, banner_messages
|
||||
curr_writer = config.local_writer.setup(banner_messages=banner_messages)
|
||||
EVENT_WRITERS.append(curr_writer)
|
||||
else:
|
||||
logging.info("disabled local writer")
|
||||
CONSOLE.log("disabled local writer")
|
||||
|
||||
## configure all the global buffer basic information
|
||||
GLOBAL_BUFFER["max_iter"] = max_iter
|
||||
@@ -388,10 +386,10 @@ class LocalWriter:
|
||||
valid_step = step > 0 and step % GLOBAL_BUFFER["steps_per_log"] == 0
|
||||
if valid_step:
|
||||
if not self.has_printed and self.config.max_log_size:
|
||||
logging.info(
|
||||
"\x1b[33;20mPrinting max of %d lines. Set flag `--logging.local-writer.max-log-size=0` "
|
||||
"to disable line wrapping.\x1b[0m",
|
||||
self.config.max_log_size,
|
||||
CONSOLE.log(
|
||||
f"Printing max of {self.config.max_log_size} lines. "
|
||||
"Set flag `--logging.local-writer.max-log-size=0` "
|
||||
"to disable line wrapping."
|
||||
)
|
||||
latest_map, new_key = self._consolidate_events()
|
||||
self._update_header(latest_map, new_key)
|
||||
@@ -433,6 +431,7 @@ class LocalWriter:
|
||||
self.past_mssgs[0] = mssg
|
||||
self.past_mssgs[1] = "-" * len(mssg)
|
||||
if full_log_cond or not self.has_printed:
|
||||
print("testeing testing!")
|
||||
print(mssg)
|
||||
print("-" * len(mssg))
|
||||
# self.has_printed = True
|
||||
|
||||
Reference in new issue
Block a user