diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-01-07 23:26:05 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-01-18 18:31:09 +0100 |
commit | b4f28814b7f5cf1d2375963db81f554d470aef83 (patch) | |
tree | 6598b3076c270ba5f91a20fc2a47d4ed4e0408be /deeptagger/bench.sh | |
parent | 054078908a1e4c7429ea0f5a3a0605addfccc46c (diff) | |
download | gallery-b4f28814b7f5cf1d2375963db81f554d470aef83.tar.gz gallery-b4f28814b7f5cf1d2375963db81f554d470aef83.tar.xz gallery-b4f28814b7f5cf1d2375963db81f554d470aef83.zip |
Add a deep tagger in C++
Diffstat (limited to 'deeptagger/bench.sh')
-rwxr-xr-x | deeptagger/bench.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/deeptagger/bench.sh b/deeptagger/bench.sh new file mode 100755 index 0000000..6b62791 --- /dev/null +++ b/deeptagger/bench.sh @@ -0,0 +1,38 @@ +#!/bin/sh -e +if [ $# -lt 2 ] || ! [ -x "$1" ] +then + echo "Usage: $0 DEEPTAGGER FILE..." + echo "Run this after using download.sh, from the same directory." + exit 1 +fi + +runner=$1 +shift +log=bench.out +: >$log + +run() { + opts=$1 batch=$2 model=$3 + shift 3 + + for i in $(seq 1 3) + do + start=$(date +%s) + "$runner" $opts -b "$batch" -t 0.75 "$model" "$@" >/dev/null || : + end=$(date +%s) + printf '%s\t%s\t%s\t%s\t%s\n' \ + "$name" "$model" "$opts" "$batch" "$((end - start))" | tee -a $log + done +} + +for model in models/*.model +do + name=$(sed -n 's/^name=//p' "$model") + run "" 1 "$model" "$@" + run "" 4 "$model" "$@" + run "" 16 "$model" "$@" + + run --cpu 1 "$model" "$@" + run --cpu 4 "$model" "$@" + run --cpu 16 "$model" "$@" +done |