Welcome to mirror list, hosted at ThFree Co, Russian Federation.

comet-score.sh « scripts « transformer-intro - github.com/marian-nmt/marian-examples.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 64f51496813863b47125584afb65402d0f8f5ec8 (plain)
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
#!/usr/bin/env bash
set -euo pipefail

# Compute Comet score
# Perform on CPU to avoid competing for GPU memory

# Usage:
# 1) Score against default validation set
#   ./comet-score hypothesis.txt
# 2) Score against a different source/reference
#   ./comet-score hypothesis.txt source.txt reference.txt

if [[ "$#" -eq 1 ]]; then
  src="data/valid.en"
  ref="data/valid.de"
elif [[ "$#" -eq 3 ]]; then
  src=$2
  ref=$3
else
  echo "Usage: $0 hypothesis.txt [source.txt reference.txt]"
  exit 1
fi

trg=$1

comet-score \
  --gpus 0 \
  -s ${src} \
  -t ${trg} \
  -r ${ref} \
  --model wmt20-comet-da \
  2> ./scripts/.comet.stderr.log \
  | tail -1 \
  | grep -oP "([+-]?\d+.\d+)"