-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
executable file
·55 lines (45 loc) · 1.2 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
echo ------------------------------
echo Building evaluator
echo ------------------------------
echo
cd evaluator
docker build -t scifact-evaluator .
cd ..
echo
echo ------------------------------
echo Running evaluator
echo ------------------------------
echo
OUTPUT_DIR=/tmp/$RANDOM.$$
mkdir $OUTPUT_DIR
docker run \
-v $PWD/fixture/gold_small.jsonl:/data/gold_small.jsonl:ro \
-v $PWD/fixture/predictions_small.jsonl:/predictions/predictions_small.jsonl:ro \
-v $OUTPUT_DIR:/output:rw \
scifact-evaluator \
python eval.py --labels_file /data/gold_small.jsonl --preds_file /predictions/predictions_small.jsonl --metrics_output_file /output/metrics.json --verbose
echo
echo ------------------------------
echo Metrics
echo ------------------------------
echo
EXPECTED=$(cat fixture/expected_metrics_small.json)
ACTUAL=$(cat $OUTPUT_DIR/metrics.json)
echo Metrics obtained in file $OUTPUT_DIR/metrics.json:
echo
echo $ACTUAL
echo
if [ "$ACTUAL" == "$EXPECTED" ]; then
echo Metrics match expected values!
echo
echo Test passed.
else
echo Metrics DO NOT match expected values! Expected:
echo
echo $EXPECTED
echo
echo Something is wrong, test failed.
exit 1
fi