#!/bin/csh -f rm -rf report touch report mkdir temp foreach f1(`cat $argv[1] `) set url = "https://github.com/onnx/models/raw/main/$f1" echo "Downloading to $url" mkdir -p ./temp/$f1:h/ curl -L -o ./temp/$f1:h/model.onnx "$url" echo "Converting to version 17" python ./upgrade_onnx.py ./temp/$f1:h/model.onnx ./temp/$f1:h/model-17.onnx echo "Import onnx model" python -m iree.compiler.tools.import_onnx ./temp/$f1:h/model-17.onnx -o ./temp/$f1:h/model.mlir if(-e ./temp/$f1:h/model.mlir) then echo "Compile onnx model" python -m iree.compiler.tools.scripts.ireec ./temp/$f1:h/model.mlir -o ./temp/$f1:h/model.vmfb --iree-input-type=onnx --iree-hal-target-backends=llvm-cpu >&! ./temp/$f1:h/iree-compile.log grep -i error ./temp/$f1:h/iree-compile.log >&/dev/null if($status == 0) then echo "$f1 : ERROR_IN_COMPILE" >> report else rm -rf temp/$f1:h/* endif endif rm -rf ./temp/$f1:h/*.onnx end