Spaces:
Sleeping
Sleeping
diag: show_error=True, persist tracebacks to o2laf-debug dataset
Browse files
app.py
CHANGED
|
@@ -123,6 +123,29 @@ def get_extractor(model_key: str):
|
|
| 123 |
return extractor
|
| 124 |
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
def repair_unpatched_torch() -> None:
|
| 127 |
"""Undo what ZeroGPU's unpatch() misses in the GPU worker, before torch.compile.
|
| 128 |
|
|
@@ -245,8 +268,7 @@ def run_transfer(source_video, first_frame, model_key, guidance, steps, seed):
|
|
| 245 |
try:
|
| 246 |
return _run_transfer(source_video, first_frame, model_key, guidance, steps, seed)
|
| 247 |
except Exception as exc:
|
| 248 |
-
|
| 249 |
-
raise gr.Error(f"O2LaF failed: {type(exc).__name__}: {exc}") from None
|
| 250 |
|
| 251 |
|
| 252 |
def _run_transfer(source_video, first_frame, model_key, guidance, steps, seed):
|
|
@@ -283,8 +305,7 @@ def run_idm(source_video, model_key, block, head):
|
|
| 283 |
try:
|
| 284 |
return _run_idm(source_video, model_key, block, head)
|
| 285 |
except Exception as exc:
|
| 286 |
-
|
| 287 |
-
raise gr.Error(f"O2LaF failed: {type(exc).__name__}: {exc}") from None
|
| 288 |
|
| 289 |
|
| 290 |
def _run_idm(source_video, model_key, block, head):
|
|
@@ -310,8 +331,7 @@ def run_atomic(first_frame, action, num_frames, steps, seed):
|
|
| 310 |
try:
|
| 311 |
return _run_atomic(first_frame, action, num_frames, steps, seed)
|
| 312 |
except Exception as exc:
|
| 313 |
-
|
| 314 |
-
raise gr.Error(f"O2LaF failed: {type(exc).__name__}: {exc}") from None
|
| 315 |
|
| 316 |
|
| 317 |
def _run_atomic(first_frame, action, num_frames, steps, seed):
|
|
@@ -506,4 +526,4 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css, title="O2LaF") as demo:
|
|
| 506 |
|
| 507 |
|
| 508 |
if __name__ == "__main__":
|
| 509 |
-
demo.launch()
|
|
|
|
| 123 |
return extractor
|
| 124 |
|
| 125 |
|
| 126 |
+
def _report(exc: Exception):
|
| 127 |
+
"""Print + persist the full traceback (run logs are hard to read), then surface it."""
|
| 128 |
+
tb = traceback.format_exc()
|
| 129 |
+
print(tb, flush=True)
|
| 130 |
+
try:
|
| 131 |
+
import time as _time
|
| 132 |
+
|
| 133 |
+
from huggingface_hub import HfApi
|
| 134 |
+
|
| 135 |
+
path = tempfile.mktemp(suffix=".txt")
|
| 136 |
+
with open(path, "w") as f:
|
| 137 |
+
f.write(tb)
|
| 138 |
+
HfApi().upload_file(
|
| 139 |
+
path_or_fileobj=path,
|
| 140 |
+
path_in_repo=f"err/{int(_time.time())}.txt",
|
| 141 |
+
repo_id="blanchon/o2laf-debug",
|
| 142 |
+
repo_type="dataset",
|
| 143 |
+
)
|
| 144 |
+
except Exception:
|
| 145 |
+
traceback.print_exc()
|
| 146 |
+
return gr.Error(f"O2LaF failed: {type(exc).__name__}: {exc}")
|
| 147 |
+
|
| 148 |
+
|
| 149 |
def repair_unpatched_torch() -> None:
|
| 150 |
"""Undo what ZeroGPU's unpatch() misses in the GPU worker, before torch.compile.
|
| 151 |
|
|
|
|
| 268 |
try:
|
| 269 |
return _run_transfer(source_video, first_frame, model_key, guidance, steps, seed)
|
| 270 |
except Exception as exc:
|
| 271 |
+
raise _report(exc) from None
|
|
|
|
| 272 |
|
| 273 |
|
| 274 |
def _run_transfer(source_video, first_frame, model_key, guidance, steps, seed):
|
|
|
|
| 305 |
try:
|
| 306 |
return _run_idm(source_video, model_key, block, head)
|
| 307 |
except Exception as exc:
|
| 308 |
+
raise _report(exc) from None
|
|
|
|
| 309 |
|
| 310 |
|
| 311 |
def _run_idm(source_video, model_key, block, head):
|
|
|
|
| 331 |
try:
|
| 332 |
return _run_atomic(first_frame, action, num_frames, steps, seed)
|
| 333 |
except Exception as exc:
|
| 334 |
+
raise _report(exc) from None
|
|
|
|
| 335 |
|
| 336 |
|
| 337 |
def _run_atomic(first_frame, action, num_frames, steps, seed):
|
|
|
|
| 526 |
|
| 527 |
|
| 528 |
if __name__ == "__main__":
|
| 529 |
+
demo.launch(show_error=True)
|