fix: clean skip for terramind_nyc on torchvision::nms
Browse filesSame pattern as terramind_synthesis: when remote inference returns
non-ok or is unreachable AND local _ensure_adapter() raises the
torchvision binary-extension error, surface a clean 'skipped'
result with both root causes named instead of a noisy err.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- app/context/terramind_nyc.py +16 -0
app/context/terramind_nyc.py
CHANGED
|
@@ -358,6 +358,22 @@ def _run(adapter_name: str, modality_chips: dict, summarizer):
|
|
| 358 |
result["compute"] = "local"
|
| 359 |
return result
|
| 360 |
except Exception as e:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
log.exception("terramind_nyc.%s failed", adapter_name)
|
| 362 |
return {"ok": False, "err": f"{type(e).__name__}: {e}",
|
| 363 |
"elapsed_s": round(time.time() - t0, 2)}
|
|
|
|
| 358 |
result["compute"] = "local"
|
| 359 |
return result
|
| 360 |
except Exception as e:
|
| 361 |
+
msg = str(e)
|
| 362 |
+
# Translate torchvision binary-extension failures into a clean
|
| 363 |
+
# skip. terratorch + torchvision both ride a transitive
|
| 364 |
+
# dep cone on the HF Space (sentence-transformers pulls torch
|
| 365 |
+
# CPU; torchvision's C extension can't load against that wheel),
|
| 366 |
+
# so a local _ensure_adapter() raises RuntimeError with this
|
| 367 |
+
# signature when remote is also unreachable. Clean skip is the
|
| 368 |
+
# honest demo outcome — same as terramind_synthesis.
|
| 369 |
+
if "torchvision::nms" in msg or "torchvision_C" in msg:
|
| 370 |
+
log.warning("terramind_nyc/%s: torchvision binary unavailable; "
|
| 371 |
+
"remote unreachable too; clean skip", adapter_name)
|
| 372 |
+
return {"ok": False,
|
| 373 |
+
"skipped": "remote inference unreachable + local "
|
| 374 |
+
"torchvision binary unavailable on this "
|
| 375 |
+
"deployment",
|
| 376 |
+
"elapsed_s": round(time.time() - t0, 2)}
|
| 377 |
log.exception("terramind_nyc.%s failed", adapter_name)
|
| 378 |
return {"ok": False, "err": f"{type(e).__name__}: {e}",
|
| 379 |
"elapsed_s": round(time.time() - t0, 2)}
|