batdetect2-uk-same-onnx / scripts /fetch-upstream.sh
legojoey17's picture
Add model repository contents
a187b6b
Raw
History Blame Contribute Delete
1.22 kB
#!/bin/sh
set -eu
repository_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
target=${1:-"$repository_root/.repro/batdetect2"}
url='https://github.com/macaodha/batdetect2.git'
revision='9e2697458d3b3b03c30ccd7e49ed5409c8ac330d'
checkpoint='src/batdetect2/models/checkpoints/batdetect2_uk_same.ckpt'
expected_sha256='52e3f329a046e434d16751005b252b4fd1b142b8b63a4edc2740aeb81f48adcf'
if test ! -e "$target"; then
mkdir -p "$(dirname -- "$target")"
git clone --filter=blob:none --no-checkout "$url" "$target"
git -C "$target" checkout --detach "$revision"
elif test ! -d "$target/.git"; then
echo "$target exists but is not a Git checkout" >&2
exit 1
fi
actual_revision=$(git -C "$target" rev-parse HEAD)
test "$actual_revision" = "$revision" || {
echo "$target: expected revision $revision, got $actual_revision" >&2
exit 1
}
actual_sha256=$(shasum -a 256 "$target/$checkpoint" | awk '{print $1}')
test "$actual_sha256" = "$expected_sha256" || {
echo "$target/$checkpoint: expected SHA-256 $expected_sha256, got $actual_sha256" >&2
exit 1
}
cmp "$target/$checkpoint" "$repository_root/upstream/batdetect2_uk_same.ckpt"
echo "$target: pinned source revision and archived checkpoint verified"