Skip to content

Commit

Permalink
🚀 fixed get total steps and update summary
Browse files Browse the repository at this point in the history
  • Loading branch information
nglehuy committed Dec 24, 2020
1 parent dbe95e7 commit c2e1ddf
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</h2>

<p align="center">
TensorFlowASR implements some automatic speech recognition architectures such as DeepSpeech2, Jasper, ContextNet, Conformer, etc. These models can be converted to TFLite to reduce memory and computation for deployment :smile:
TensorFlowASR implements some automatic speech recognition architectures such as DeepSpeech2, Jasper, RNN Transducer, ContextNet, Conformer, etc. These models can be converted to TFLite to reduce memory and computation for deployment :smile:
</p>

## What's New?
Expand Down Expand Up @@ -95,7 +95,7 @@ python3 setup.py install
For anaconda3:

```bash
conda create -y -n tfasr tensorflow-gpu python=3.7 # tensorflow if using CPU
conda create -y -n tfasr tensorflow-gpu python=3.8 # tensorflow if using CPU
conda activate tfasr
pip install -U tensorflow-gpu # upgrade to latest version of tensorflow
git clone https://github.com/TensorSpeech/TensorFlowASR.git
Expand Down
4 changes: 2 additions & 2 deletions examples/deepspeech2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ model_config:
## Training and Testing
See `python examples/deepspeech2/train_ds2.py --help`
See `python examples/deepspeech2/train_*.py --help`

See `python examples/deepspeech2/test_ds2.py --help`
See `python examples/deepspeech2/test_*.py --help`
4 changes: 2 additions & 2 deletions examples/jasper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ model_config:
## Training and Testing
See `python examples/jasper/train_jasper.py --help`
See `python examples/jasper/train_*.py --help`

See `python examples/jasper/test_jasper.py --help`
See `python examples/jasper/test_*.py --help`
32 changes: 17 additions & 15 deletions examples/streaming_transducer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ decoder_config:

model_config:
name: streaming_transducer
reduction_factor: 2
reduction_positions: [1]
encoder_dim: 320
encoder_units: 1024
encoder_layers: 7
encoder_reductions:
0: 3
1: 2
encoder_dmodel: 320
encoder_rnn_type: lstm
encoder_rnn_units: 1024
encoder_nlayers: 8
encoder_layer_norm: True
encoder_type: lstm
embed_dim: 320
embed_dropout: 0.1
num_rnns: 1
rnn_units: 320
rnn_type: lstm
layer_norm: True
prediction_embed_dim: 320
prediction_embed_dropout: 0.0
prediction_num_rnns: 2
prediction_rnn_units: 1024
prediction_rnn_type: lstm
prediction_projection_units: 320
prediction_layer_norm: True
joint_dim: 320

learning_config:
Expand Down Expand Up @@ -69,8 +71,8 @@ learning_config:
## Usage
Training, see `python examples/streamingTransducer/train_streaming_transducer.py --help`
Training, see `python examples/streamingTransducer/train_*.py --help`

Testing, see `python examples/streamingTransducer/train_streaming_transducer.py --help`
Testing, see `python examples/streamingTransducer/test_*.py --help`

TFLite Conversion, see `python examples/streamingTransducer/tflite_streaming_transducer.py --help`
TFLite Conversion, see `python examples/streamingTransducer/tflite_*.py --help`
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
"soundfile>=0.10.3",
"PyYAML>=5.3.1",
"matplotlib>=3.2.1",
"numpy>=1.16.0,<1.19.0",
"sox>=1.3.7",
"nltk>=3.5",
"numba==0.49.1",
"tqdm>=4.51.0",
"colorama>=0.4.3",
Expand All @@ -37,7 +35,7 @@

setuptools.setup(
name="TensorFlowASR",
version="0.5.3",
version="0.5.4",
author="Huy Le Nguyen",
author_email="[email protected]",
description="Almost State-of-the-art Automatic Speech Recognition using Tensorflow 2",
Expand Down
1 change: 1 addition & 0 deletions tensorflow_asr/models/transducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def _build(self, input_shape):
self([inputs, input_length, pred, pred_length], training=False)

def summary(self, line_length=None, **kwargs):
if self.encoder is not None: self.encoder.summary(line_length=line_length, **kwargs)
self.predict_net.summary(line_length=line_length, **kwargs)
self.joint_net.summary(line_length=line_length, **kwargs)
super(Transducer, self).summary(line_length=line_length, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_asr/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def bytes_to_string(array: np.ndarray, encoding: str = "utf-8"):


def get_num_batches(samples, batch_size, drop_remainders=True):
if drop_remainders:
return math.floor(float(samples) / float(batch_size))
if samples is None or batch_size is None: return None
if drop_remainders: return math.floor(float(samples) / float(batch_size))
return math.ceil(float(samples) / float(batch_size))


Expand Down

0 comments on commit c2e1ddf

Please sign in to comment.