Skip to content

Commit

Permalink
Merge pull request #47 from lissyx/package
Browse files Browse the repository at this point in the history
Package TensorFlow and TFLite models and checkpoints
  • Loading branch information
lissyx authored Jun 12, 2019
2 parents e575cd1 + 8ac174e commit c9bf8b3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DeepSpeech/Dockerfile.train.fr
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends \
pixz \
sox \
libsox-fmt-all \
locales locales-all
locales locales-all \
zip

RUN groupadd -g 999 trainer && \
adduser --system --uid 999 --group trainer
Expand Down
30 changes: 30 additions & 0 deletions DeepSpeech/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -xe

pushd /mnt
zip -r9 --junk-paths \
model_tensorflow_fr.zip \
models/output_graph.pbmm \
models/alphabet.txt \
lm/lm.binary \
lm/trie

zip -r9 --junk-paths \
model_tflite_fr.zip \
models/output_graph.tflite \
models/alphabet.txt \
lm/lm.binary \
lm/trie

all_checkpoint_path=""
for ckpt in $(grep 'all_model_checkpoint_paths' checkpoints/checkpoint | cut -d'"' -f2);
do
all_checkpoint_path="${all_checkpoint_path} ${ckpt}.*"
done;

zip -r9 --junk-paths \
checkpoint_fr.zip \
checkpoints/checkpoint \
${all_checkpoint_path}
popd
2 changes: 2 additions & 0 deletions DeepSpeech/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ generate_alphabet.sh
build_lm.sh

train_fr.sh

package.sh
4 changes: 3 additions & 1 deletion DeepSpeech/train_fr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ pushd $HOME/ds/

mkdir -p /mnt/sources/feature_cache || true

if [ -f "/transfer-checkpoint/checkpoint" ]; then
# Do not overwrite checkpoint file if model already exist: we will likely
# only package
if [ -f "/transfer-checkpoint/checkpoint" -a ! -f "/mnt/models/output_graph.pb" ]; then
echo "Using checkpoint from ${TRANSFER_CHECKPOINT}"
cp -a /transfer-checkpoint/* /mnt/checkpoints/
fi;
Expand Down

0 comments on commit c9bf8b3

Please sign in to comment.