Skip to content

Commit c2e1ddf

Browse files
committed
🚀 fixed get total steps and update summary
1 parent dbe95e7 commit c2e1ddf

File tree

7 files changed

+27
-26
lines changed

7 files changed

+27
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</h2>
1717

1818
<p align="center">
19-
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:
19+
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:
2020
</p>
2121

2222
## What's New?
@@ -95,7 +95,7 @@ python3 setup.py install
9595
For anaconda3:
9696

9797
```bash
98-
conda create -y -n tfasr tensorflow-gpu python=3.7 # tensorflow if using CPU
98+
conda create -y -n tfasr tensorflow-gpu python=3.8 # tensorflow if using CPU
9999
conda activate tfasr
100100
pip install -U tensorflow-gpu # upgrade to latest version of tensorflow
101101
git clone https://github.com/TensorSpeech/TensorFlowASR.git

examples/deepspeech2/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ model_config:
2727
2828
## Training and Testing
2929
30-
See `python examples/deepspeech2/train_ds2.py --help`
30+
See `python examples/deepspeech2/train_*.py --help`
3131

32-
See `python examples/deepspeech2/test_ds2.py --help`
32+
See `python examples/deepspeech2/test_*.py --help`

examples/jasper/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ model_config:
3535
3636
## Training and Testing
3737
38-
See `python examples/jasper/train_jasper.py --help`
38+
See `python examples/jasper/train_*.py --help`
3939

40-
See `python examples/jasper/test_jasper.py --help`
40+
See `python examples/jasper/test_*.py --help`

examples/streaming_transducer/README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ decoder_config:
2626

2727
model_config:
2828
name: streaming_transducer
29-
reduction_factor: 2
30-
reduction_positions: [1]
31-
encoder_dim: 320
32-
encoder_units: 1024
33-
encoder_layers: 7
29+
encoder_reductions:
30+
0: 3
31+
1: 2
32+
encoder_dmodel: 320
33+
encoder_rnn_type: lstm
34+
encoder_rnn_units: 1024
35+
encoder_nlayers: 8
3436
encoder_layer_norm: True
35-
encoder_type: lstm
36-
embed_dim: 320
37-
embed_dropout: 0.1
38-
num_rnns: 1
39-
rnn_units: 320
40-
rnn_type: lstm
41-
layer_norm: True
37+
prediction_embed_dim: 320
38+
prediction_embed_dropout: 0.0
39+
prediction_num_rnns: 2
40+
prediction_rnn_units: 1024
41+
prediction_rnn_type: lstm
42+
prediction_projection_units: 320
43+
prediction_layer_norm: True
4244
joint_dim: 320
4345

4446
learning_config:
@@ -69,8 +71,8 @@ learning_config:
6971
7072
## Usage
7173
72-
Training, see `python examples/streamingTransducer/train_streaming_transducer.py --help`
74+
Training, see `python examples/streamingTransducer/train_*.py --help`
7375

74-
Testing, see `python examples/streamingTransducer/train_streaming_transducer.py --help`
76+
Testing, see `python examples/streamingTransducer/test_*.py --help`
7577

76-
TFLite Conversion, see `python examples/streamingTransducer/tflite_streaming_transducer.py --help`
78+
TFLite Conversion, see `python examples/streamingTransducer/tflite_*.py --help`

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
"soundfile>=0.10.3",
2727
"PyYAML>=5.3.1",
2828
"matplotlib>=3.2.1",
29-
"numpy>=1.16.0,<1.19.0",
3029
"sox>=1.3.7",
31-
"nltk>=3.5",
3230
"numba==0.49.1",
3331
"tqdm>=4.51.0",
3432
"colorama>=0.4.3",
@@ -37,7 +35,7 @@
3735

3836
setuptools.setup(
3937
name="TensorFlowASR",
40-
version="0.5.3",
38+
version="0.5.4",
4139
author="Huy Le Nguyen",
4240
author_email="[email protected]",
4341
description="Almost State-of-the-art Automatic Speech Recognition using Tensorflow 2",

tensorflow_asr/models/transducer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def _build(self, input_shape):
242242
self([inputs, input_length, pred, pred_length], training=False)
243243

244244
def summary(self, line_length=None, **kwargs):
245+
if self.encoder is not None: self.encoder.summary(line_length=line_length, **kwargs)
245246
self.predict_net.summary(line_length=line_length, **kwargs)
246247
self.joint_net.summary(line_length=line_length, **kwargs)
247248
super(Transducer, self).summary(line_length=line_length, **kwargs)

tensorflow_asr/utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def bytes_to_string(array: np.ndarray, encoding: str = "utf-8"):
6363

6464

6565
def get_num_batches(samples, batch_size, drop_remainders=True):
66-
if drop_remainders:
67-
return math.floor(float(samples) / float(batch_size))
66+
if samples is None or batch_size is None: return None
67+
if drop_remainders: return math.floor(float(samples) / float(batch_size))
6868
return math.ceil(float(samples) / float(batch_size))
6969

7070

0 commit comments

Comments
 (0)