Spaces:
Running
on
Zero
Running
on
Zero
Update scene_weaver_core.py
Browse files- scene_weaver_core.py +10 -2
scene_weaver_core.py
CHANGED
|
@@ -117,7 +117,15 @@ class SceneWeaverCore:
|
|
| 117 |
logger.info(f"SceneWeaverCore initialized on {self.device}")
|
| 118 |
|
| 119 |
def _setup_device(self, device: str) -> str:
|
| 120 |
-
"""Setup computation device"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
if device == "auto":
|
| 122 |
if torch.cuda.is_available():
|
| 123 |
return "cuda"
|
|
@@ -1174,4 +1182,4 @@ class SceneWeaverCore:
|
|
| 1174 |
|
| 1175 |
status = self._inpainting_module.get_status()
|
| 1176 |
status["mode"] = self._current_mode
|
| 1177 |
-
return status
|
|
|
|
| 117 |
logger.info(f"SceneWeaverCore initialized on {self.device}")
|
| 118 |
|
| 119 |
def _setup_device(self, device: str) -> str:
|
| 120 |
+
"""Setup computation device (ZeroGPU compatible)"""
|
| 121 |
+
import os
|
| 122 |
+
|
| 123 |
+
# On Hugging Face Spaces with ZeroGPU, use CPU for initialization
|
| 124 |
+
# GPU will be allocated by @spaces.GPU decorator at runtime
|
| 125 |
+
if os.getenv('SPACE_ID') is not None:
|
| 126 |
+
logger.info("Running on Hugging Face Spaces - using CPU for initialization")
|
| 127 |
+
return "cpu"
|
| 128 |
+
|
| 129 |
if device == "auto":
|
| 130 |
if torch.cuda.is_available():
|
| 131 |
return "cuda"
|
|
|
|
| 1182 |
|
| 1183 |
status = self._inpainting_module.get_status()
|
| 1184 |
status["mode"] = self._current_mode
|
| 1185 |
+
return status
|