From b6d0f2fab8df3d70ef643242f3cd4bcc40b64092 Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Wed, 15 Sep 2021 11:26:07 +0000 Subject: [PATCH] fix profiler --- deepspeech/training/trainer.py | 3 ++- deepspeech/utils/profiler.py | 3 +++ examples/tiny/s0/conf/deepspeech2.yaml | 2 +- examples/tiny/s0/local/train.sh | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deepspeech/training/trainer.py b/deepspeech/training/trainer.py index bdb68310a..b31ddcad6 100644 --- a/deepspeech/training/trainer.py +++ b/deepspeech/training/trainer.py @@ -185,7 +185,8 @@ class Trainer(): batch_sampler.set_epoch(self.epoch) def after_train_batch(self): - profiler.add_profiler_step(self.args.profiler_options) + if self.args.profiler_options: + profiler.add_profiler_step(self.args.profiler_options) def train(self): """The training process control by epoch.""" diff --git a/deepspeech/utils/profiler.py b/deepspeech/utils/profiler.py index 5b8389be8..357840a62 100644 --- a/deepspeech/utils/profiler.py +++ b/deepspeech/utils/profiler.py @@ -61,6 +61,9 @@ class ProfilerOptions(object): self._parse_from_string(options_str) def _parse_from_string(self, options_str): + if not options_str: + return + for kv in options_str.replace(' ', '').split(';'): key, value = kv.split('=') if key == 'batch_range': diff --git a/examples/tiny/s0/conf/deepspeech2.yaml b/examples/tiny/s0/conf/deepspeech2.yaml index 64598b4be..408996557 100644 --- a/examples/tiny/s0/conf/deepspeech2.yaml +++ b/examples/tiny/s0/conf/deepspeech2.yaml @@ -48,7 +48,7 @@ training: n_epoch: 10 accum_grad: 1 lr: 1e-5 - lr_decay: 1.0 + lr_decay: 0.8 weight_decay: 1e-06 global_grad_clip: 5.0 log_interval: 1 diff --git a/examples/tiny/s0/local/train.sh b/examples/tiny/s0/local/train.sh index a657ce345..f96508b4f 100755 --- a/examples/tiny/s0/local/train.sh +++ b/examples/tiny/s0/local/train.sh @@ -38,7 +38,7 @@ python3 -u ${BIN_DIR}/train.py \ --config ${config_path} \ --output exp/${ckpt_name} \ --model_type ${model_type} \ ---profiler_options ${profiler_options} \ +--profiler_options "${profiler_options}" \ --seed ${seed} if [ ${seed} != 0 ]; then