-
Notifications
You must be signed in to change notification settings - Fork 1
/
package.sh
executable file
·38 lines (31 loc) · 1.32 KB
/
package.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
#!/bin/bash
set -xe
pushd //mnt
if [ ! -f "model_tensorflow_kab.tar.xz" ]; then
tar -cf - \
-C /mnt/models/ output_graph.pbmm \
-C $HOMEDIR/${MODEL_LANGUAGE}/data_kab/ alphabet.txt \
-C /mnt/lm/ kenlm.scorer | xz -T0 > model_tensorflow_kab.tar.xz
fi;
if [ ! -f "model_tflite_kab.tar.xz" ]; then
tar -cf - \
-C /mnt/models/ output_graph.tflite \
-C $HOMEDIR/${MODEL_LANGUAGE}/data_kab/ alphabet.txt \
-C /mnt/lm/ kenlm.scorer | xz -T0 > model_tflite_kab.tar.xz
fi;
if [ ! -f "checkpoint_kab.tar.xz" ]; then
all_checkpoint_path=""
for ckpt in $(grep '^model_checkpoint_path:' checkpoints/best_dev_checkpoint | cut -d'"' -f2);
do
ckpt_file=$(basename "${ckpt}")
for f in $(find checkpoints/ -type f -name "${ckpt_file}.*");
do
ckpt_to_add=$(basename "${f}")
all_checkpoint_path="${all_checkpoint_path} ${ckpt_to_add}"
done;
done;
tar -cf - \
-C /mnt/checkpoints/ best_dev_checkpoint ${all_checkpoint_path} | xz -T0 > "checkpoint_kab.tar.xz"
fi;
cp /mnt/models/*.zip .
popd