Spaces:
Paused
Paused
Download config/refine.py from modventures/room-visualizer: direct link, hf CLI and curl.
- Browser
- Download file 2.53 kB
-
https://huggingface.co/spaces/modventures/room-visualizer/resolve/main/config/refine.py
- Command line
-
hf download hf://spaces/modventures/room-visualizer/config/refine.py
-
curl -L -o refine.py https://huggingface.co/spaces/modventures/room-visualizer/resolve/main/config/refine.py
2.53 kB
| """Configuration for the SDXL refinement pass.""" | |
| from config.loader import config_bool, config_value | |
| REFINE_ENABLED = config_bool("REFINE_ENABLED", "refine", "enabled", "1") | |
| # Refinement on CPU is not viable -- SDXL would take tens of minutes per pass. | |
| # Left on so a CPU dev box returns a clear 503 instead of hanging. | |
| REFINE_REQUIRE_CUDA = config_bool("REFINE_REQUIRE_CUDA", "refine", "require_cuda", "1") | |
| REFINE_BASE_MODEL = str(config_value( | |
| "REFINE_BASE_MODEL", "refine", "base_model", | |
| "diffusers/stable-diffusion-xl-1.0-inpainting-0.1", | |
| )) | |
| REFINE_CONTROLNET_MODEL = str(config_value( | |
| "REFINE_CONTROLNET_MODEL", "refine", "controlnet_model", | |
| "diffusers/controlnet-depth-sdxl-1.0", | |
| )) | |
| # Processing resolution. Drop to 768 on a 16 GB card if a pass hits CUDA OOM; | |
| # raise to 1024 where there is headroom. Rounded down to a multiple of 8. | |
| REFINE_MAX_DIMENSION = max(512, int(config_value( | |
| "REFINE_MAX_DIMENSION", "refine", "max_dimension", "896", | |
| ))) | |
| REFINE_SEED = int(config_value("REFINE_SEED", "refine", "seed", "42")) | |
| # "detail-recovery" keeps SDXL's look and restores texture from the projection. | |
| # "realism-guide" keeps the projection and transfers only SDXL's illumination. | |
| REFINE_BLEND_MODE = str(config_value( | |
| "REFINE_BLEND_MODE", "refine", "blend_mode", "detail-recovery", | |
| )).strip().lower() | |
| REFINE_USE_LIGHTING_TRANSFER = config_bool( | |
| "REFINE_USE_LIGHTING_TRANSFER", "refine", "use_lighting_transfer", "1") | |
| REFINE_USE_SHADOW_TRANSFER = config_bool( | |
| "REFINE_USE_SHADOW_TRANSFER", "refine", "use_shadow_transfer", "1") | |
| REFINE_USE_MATERIAL_MICRODETAIL = config_bool( | |
| "REFINE_USE_MATERIAL_MICRODETAIL", "refine", "use_material_microdetail", "0") | |
| REFINE_USE_CAMERA_NOISE = config_bool( | |
| "REFINE_USE_CAMERA_NOISE", "refine", "use_camera_noise", "0") | |
| REFINE_USE_POST_SHADOW_RESTORE = config_bool( | |
| "REFINE_USE_POST_SHADOW_RESTORE", "refine", "use_post_shadow_restore", "1") | |
| # Free OneFormer / MoGe / depth before loading SDXL. They are idle by the time | |
| # refinement runs and together with SDXL they will not fit a 16 GB card. | |
| REFINE_UNLOAD_CV_MODELS = config_bool( | |
| "REFINE_UNLOAD_CV_MODELS", "refine", "unload_cv_models", "1") | |
| # Stream SDXL submodules from CPU instead of holding the whole pipeline on the | |
| # GPU. Roughly halves peak VRAM and roughly doubles pass time. | |
| REFINE_CPU_OFFLOAD = config_bool("REFINE_CPU_OFFLOAD", "refine", "cpu_offload", "0") | |
| REFINE_TARGET_MS = max(5_000, int(config_value( | |
| "REFINE_TARGET_MS", "refine", "target_ms", "120000", | |
| ))) | |