Add Edge TPU subprocess probe to safely detect segfaults
Probes the Edge TPU in a subprocess before loading — catches segfaults (libedgetpu ABI mismatch on Debian Trixie/Python 3.13) and falls back to CPU automatically. No more service crashes on Coral incompatibility. When the runtime is eventually fixed, Edge TPU will be used automatically with no config changes needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -469,8 +469,8 @@ async def startup():
|
||||
edgetpu_model_path = model_dir / "yamnet_edgetpu.tflite"
|
||||
model_path = model_dir / "yamnet.tflite"
|
||||
class_map_path = model_dir / "yamnet_class_map.csv"
|
||||
# Edge TPU opt-in via env var (segfaults with some libedgetpu versions)
|
||||
use_edgetpu = os.environ.get("USE_EDGETPU", "").lower() in ("1", "true", "yes") and edgetpu_model_path.exists()
|
||||
# Auto-detect Edge TPU — probe in subprocess catches segfaults safely
|
||||
use_edgetpu = edgetpu_model_path.exists()
|
||||
active_model = edgetpu_model_path if use_edgetpu else model_path
|
||||
if active_model.exists() and class_map_path.exists():
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user