swiftail's picture
CoreML-friendly ONNX re-export of BiRefNet_lite (ZhengPeng7)
6383c88 verified
Raw History Blame Contribute Delete
638 Bytes
#!/bin/bash
# build.sh <hf_repo> <name> [size]: export dynamic at 512 -> fix to size -> ORT basic fold
set -e; cd /tmp/mixer-bg-spike; S=${3:-1024}
.venv/bin/python watchdog.py .venv/bin/python reexport/export.py "$1" models/$2_dyn.onnx ${TRACE:-512} 2>&1 | grep -E "exported|PEAK|Error|WATCHDOG"
.venv/bin/python -m onnxruntime.tools.make_dynamic_shape_fixed --input_name input_image --input_shape 1,3,$S,$S models/$2_dyn.onnx models/$2_fixed.onnx
.venv/bin/python watchdog.py .venv/bin/python ort_fold.py models/$2_fixed.onnx models/$2.onnx 2>&1 | tail -2
rm -f models/$2_fixed.onnx; ls -la models/$2.onnx; shasum -a 256 models/$2.onnx