blob: 22dd863dd4c9c0f8f63aa33b2ee37f637a448628 (
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
|
#!/bin/bash -x
#####################################################################
# SUMMARY: Make sure that the resulting model is in quantized form
# AUTHOR: afaji
#####################################################################
# Exit on error
set -e
PREFIX=test-center
# Remove old artifacts and create working directory
rm -rf train
mkdir -p train
# Train an 8-bits model
$MRT_MARIAN/marian \
--no-shuffle --seed 1111 --dim-emb 32 --dim-rnn 64 --mini-batch 32 --maxi-batch 1 --maxi-batch-sort none --learn-rate 0.1 --optimizer sgd \
-m train/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v train/vocab.en.yml train/vocab.de.yml \
--cost-type cross-entropy --sync-sgd --after-batches 10 --disp-freq 2 --quantize-bits 3
# Check if files exist
test -e train/model.npz
# make sure that the resulting model has no more than 256 different values (i.e. quantized)
$MRT_TOOLS/check-model-unique-vals.py train/model.npz -b 3 --print_centers -o model_centers.out
$MRT_TOOLS/diff-nums.py model_centers.out model_centers.expected -o model_centers.diff --numpy
# Exit with success code
exit 0
|