Upload interiorgen3d/config/pipeline_config.py
Browse files
interiorgen3d/config/pipeline_config.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration for InteriorGen3D pipeline.
|
| 3 |
+
"""
|
| 4 |
+
from dataclasses import dataclass, field
|
| 5 |
+
from typing import Optional, List
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@dataclass
|
| 9 |
+
class DepthConfig:
|
| 10 |
+
model_name: str = "depth-anything/Depth-Anything-V2-Large-hf"
|
| 11 |
+
input_size: int = 518
|
| 12 |
+
metric_depth: bool = True
|
| 13 |
+
device: str = "cuda"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
@dataclass
|
| 17 |
+
class SegmentationConfig:
|
| 18 |
+
sam_model: str = "facebook/sam2-hiera-large"
|
| 19 |
+
num_categories: int = 59
|
| 20 |
+
min_object_area: float = 0.01
|
| 21 |
+
device: str = "cuda"
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
@dataclass
|
| 25 |
+
class LayoutConfig:
|
| 26 |
+
model_name: str = "manycore-research/SpatialLM1.1-Qwen-0.5B"
|
| 27 |
+
quantization_bins: int = 1280
|
| 28 |
+
resolution_cm: float = 2.5
|
| 29 |
+
device: str = "cuda"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
@dataclass
|
| 33 |
+
class ShapeConfig:
|
| 34 |
+
model_name: str = "microsoft/TRELLIS-image-large"
|
| 35 |
+
voxel_resolution: int = 64
|
| 36 |
+
latent_channels: int = 8
|
| 37 |
+
num_active_voxels: int = 20000
|
| 38 |
+
flow_steps: int = 50
|
| 39 |
+
cfg_scale: float = 7.5
|
| 40 |
+
device: str = "cuda"
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
@dataclass
|
| 44 |
+
class TextureConfig:
|
| 45 |
+
texture_resolution: int = 2048
|
| 46 |
+
num_views: int = 6
|
| 47 |
+
diffusion_resolution: int = 512
|
| 48 |
+
use_pbr: bool = True
|
| 49 |
+
device: str = "cuda"
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
@dataclass
|
| 53 |
+
class ExportConfig:
|
| 54 |
+
formats: List[str] = field(default_factory=lambda: ["glb", "fbx", "obj", "usdz"])
|
| 55 |
+
texture_resolution: int = 2048
|
| 56 |
+
max_triangles: int = 500000
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@dataclass
|
| 60 |
+
class PipelineConfig:
|
| 61 |
+
depth: DepthConfig = field(default_factory=DepthConfig)
|
| 62 |
+
segmentation: SegmentationConfig = field(default_factory=SegmentationConfig)
|
| 63 |
+
layout: LayoutConfig = field(default_factory=LayoutConfig)
|
| 64 |
+
shape: ShapeConfig = field(default_factory=ShapeConfig)
|
| 65 |
+
texture: TextureConfig = field(default_factory=TextureConfig)
|
| 66 |
+
export: ExportConfig = field(default_factory=ExportConfig)
|
| 67 |
+
device: str = "cuda"
|
| 68 |
+
dtype: str = "float16"
|
| 69 |
+
seed: int = 42
|
| 70 |
+
output_dir: str = "./output"
|
| 71 |
+
max_parallel_objects: int = 4
|
| 72 |
+
|
| 73 |
+
@classmethod
|
| 74 |
+
def for_rtx4090(cls):
|
| 75 |
+
config = cls()
|
| 76 |
+
config.dtype = "float16"
|
| 77 |
+
config.shape.voxel_resolution = 64
|
| 78 |
+
config.texture.texture_resolution = 1024
|
| 79 |
+
config.max_parallel_objects = 2
|
| 80 |
+
return config
|
| 81 |
+
|
| 82 |
+
@classmethod
|
| 83 |
+
def for_a100(cls):
|
| 84 |
+
config = cls()
|
| 85 |
+
config.dtype = "bfloat16"
|
| 86 |
+
config.shape.voxel_resolution = 128
|
| 87 |
+
config.texture.texture_resolution = 2048
|
| 88 |
+
config.max_parallel_objects = 4
|
| 89 |
+
return config
|
| 90 |
+
|
| 91 |
+
@classmethod
|
| 92 |
+
def for_h100(cls):
|
| 93 |
+
config = cls()
|
| 94 |
+
config.dtype = "bfloat16"
|
| 95 |
+
config.shape.voxel_resolution = 128
|
| 96 |
+
config.texture.texture_resolution = 4096
|
| 97 |
+
config.max_parallel_objects = 8
|
| 98 |
+
return config
|
| 99 |
+
|
| 100 |
+
@classmethod
|
| 101 |
+
def lightweight(cls):
|
| 102 |
+
config = cls()
|
| 103 |
+
config.shape.voxel_resolution = 32
|
| 104 |
+
config.texture.texture_resolution = 512
|
| 105 |
+
config.max_parallel_objects = 1
|
| 106 |
+
return config
|