INNER CODE UNIT · Python
run_export_worker
ultralytics/yolo-flutter-app · scripts/export-tflite-models.py:207
def run_export_worker(model_id: str, task: TaskSpec, output_dir: Path) -> Path:
"""Run a child export process (for memory isolation) and return the generated LiteRT .tflite path."""
command = [
sys.executable,
str(Path(__file__).resolve()),
"--output-dir",
str(output_dir),
"--worker-model-id",
model_id,
"--worker-imgsz",
str(task.imgsz),
]
returncode = subprocess.run(command, check=False).returncode
exported = exported_tflite_path(output_dir, model_id)
if exported is None:
if returncode != 0:
raise subprocess.CalledProcessError(returncode, command)
raise FileNotFoundError(f"No LiteRT export found for {model_id}")