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

test_word_weighting_with_twos_sync.sh « data-weighting « features « training « tests - github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 68154af4d5d9a7d666a746350f4abbbfeb9c3c20 (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
35
#!/bin/bash

#####################################################################
# SUMMARY:
# TAGS: dataweights
#####################################################################

# Exit on error
set -e


# Remove old files
rm -rf word_twos_sync word_twos_sync.{log,out,diff}
mkdir -p word_twos_sync

# Generate a file with weights that each word has a weight 2
cat $MRT_DATA/europarl.de-en/toy.bpe.en | sed -r 's/[^ ]+/2/g' > word_twos_sync.weights.txt

# Train with word weighting
$MRT_MARIAN/marian \
    --seed 1111 --no-shuffle --dim-emb 128 --dim-rnn 256 --optimizer sgd \
    -m word_twos_sync/model.npz -t $MRT_DATA/europarl.de-en/toy.bpe.{de,en} -v vocab.{de,en}.yml --sync-sgd \
    --log word_twos_sync.log --disp-freq 5 -e 2 \
    --data-weighting word_twos_sync.weights.txt --data-weighting-type word

test -e word_twos_sync/model.npz
test -e word_twos_sync.log

# Compare costs with the expected values
cat word_twos_sync.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed -r 's/ Time.*//' > word_twos_sync.out
$MRT_TOOLS/diff-nums.py word_twos_sync.out word_twos_sync.expected -p 0.1 -o word_twos_sync.diff


# Exit with success code
exit 0