mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-25 18:39:55 +08:00
Fix test
This commit is contained in:
1 parent
410b981205
commit
293ae8d643
1 file changed
+13
-8
@@ -33,19 +33,16 @@ from torch.cuda.amp import custom_bwd, custom_fwd
|
|||||||
from torch.cuda.amp.grad_scaler import GradScaler
|
from torch.cuda.amp.grad_scaler import GradScaler
|
||||||
from torchtyping import TensorType
|
from torchtyping import TensorType
|
||||||
|
|
||||||
CONSOLE = Console(width=120)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from diffusers import PNDMScheduler, StableDiffusionPipeline
|
from diffusers import PNDMScheduler, StableDiffusionPipeline
|
||||||
from transformers import logging
|
from transformers import logging
|
||||||
|
|
||||||
except ImportError:
|
SD_AVAILABLE = True
|
||||||
CONSOLE.print("[bold red]Missing Stable Diffusion packages.")
|
|
||||||
CONSOLE.print(r"Install using [yellow]pip install nerfstudio\[gen][/yellow]")
|
|
||||||
CONSOLE.print(r"or [yellow]pip install -e .\[gen][/yellow] if installing from source.")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
logging.set_verbosity_error()
|
except ImportError:
|
||||||
|
SD_AVAILABLE = False
|
||||||
|
|
||||||
|
CONSOLE = Console(width=120)
|
||||||
IMG_DIM = 512
|
IMG_DIM = 512
|
||||||
CONST_SCALE = 0.18215
|
CONST_SCALE = 0.18215
|
||||||
SD_IDENTIFIERS = {
|
SD_IDENTIFIERS = {
|
||||||
@@ -92,6 +89,14 @@ class StableDiffusion(nn.Module):
|
|||||||
def __init__(self, device: Union[torch.device, str], num_train_timesteps: int = 1000, version="1-5") -> None:
|
def __init__(self, device: Union[torch.device, str], num_train_timesteps: int = 1000, version="1-5") -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
if not SD_AVAILABLE:
|
||||||
|
CONSOLE.print("[bold red]Missing Stable Diffusion packages.")
|
||||||
|
CONSOLE.print(r"Install using [yellow]pip install nerfstudio\[gen][/yellow]")
|
||||||
|
CONSOLE.print(r"or [yellow]pip install -e .\[gen][/yellow] if installing from source.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
logging.set_verbosity_error()
|
||||||
|
|
||||||
self.device = device
|
self.device = device
|
||||||
self.num_train_timesteps = num_train_timesteps
|
self.num_train_timesteps = num_train_timesteps
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user