diff --git a/docs/README.md b/docs/README.md index 691632ce6..3abb38f8b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,4 +21,4 @@ documentation. Done! -**Hint**: You can change the port number when starting the server. \ No newline at end of file +**Hint**: You can change the port number when starting the server. diff --git a/docs/source/recipes/Streaming-ASR/librispeech/lstm_pruned_stateless_transducer.rst b/docs/source/recipes/Streaming-ASR/librispeech/lstm_pruned_stateless_transducer.rst index 643855cc2..d09421eb5 100644 --- a/docs/source/recipes/Streaming-ASR/librispeech/lstm_pruned_stateless_transducer.rst +++ b/docs/source/recipes/Streaming-ASR/librispeech/lstm_pruned_stateless_transducer.rst @@ -531,16 +531,36 @@ First, let us install a modified version of ``ncnn``: git clone https://github.com/csukuangfj/ncnn cd ncnn git submodule update --recursive --init - python3 setup.py bdist_wheel - ls -lh dist/ - pip install ./dist/*.whl + + # Note: We don't use "python setup.py install" or "pip install ." here + + mkdir -p build-wheel + cd build-wheel + + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DNCNN_PYTHON=ON \ + -DNCNN_BUILD_BENCHMARK=OFF \ + -DNCNN_BUILD_EXAMPLES=OFF \ + -DNCNN_BUILD_TOOLS=OFF \ + .. + + make -j4 + + cd .. + + # Note: $PWD here is /path/to/ncnn + + export PYTHONPATH=$PWD/python:$PYTHONPATH + export PATH=$PWD/tools/pnnx/build/src:$PATH + export PATH=$PWD/build/tools/quantize:$PATH # now build pnnx cd tools/pnnx mkdir build cd build + cmake .. make -j4 - export PATH=$PWD/src:$PATH ./src/pnnx @@ -549,6 +569,9 @@ First, let us install a modified version of ``ncnn``: We assume that you have added the path to the binary ``pnnx`` to the environment variable ``PATH``. + We also assume that you have added ``build/tools/quantize`` to the environment + variable ``PATH`` so that you are able to use ``ncnn2int8`` later. + Second, let us export the model using ``torch.jit.trace()`` that is suitable for ``pnnx``: diff --git a/egs/librispeech/ASR/conv_emformer_transducer_stateless2/emformer2.py b/egs/librispeech/ASR/conv_emformer_transducer_stateless2/emformer2.py index 188059044..f0c92a9b4 100644 --- a/egs/librispeech/ASR/conv_emformer_transducer_stateless2/emformer2.py +++ b/egs/librispeech/ASR/conv_emformer_transducer_stateless2/emformer2.py @@ -1512,24 +1512,6 @@ class EmformerEncoder(nn.Module): ) return states - attn_caches = [ - [ - torch.zeros(self.memory_size, self.d_model, device=device), - torch.zeros(self.left_context_length, self.d_model, device=device), - torch.zeros(self.left_context_length, self.d_model, device=device), - ] - for _ in range(self.num_encoder_layers) - ] - conv_caches = [ - torch.zeros(self.d_model, self.cnn_module_kernel - 1, device=device) - for _ in range(self.num_encoder_layers) - ] - states: Tuple[List[List[torch.Tensor]], List[torch.Tensor]] = ( - attn_caches, - conv_caches, - ) - return states - class Emformer(EncoderInterface): def __init__( diff --git a/egs/librispeech/ASR/pruned_transducer_stateless7_ctc/ctc_decode.py b/egs/librispeech/ASR/pruned_transducer_stateless7_ctc/ctc_decode.py index 9c23e7d66..4b373e4c7 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless7_ctc/ctc_decode.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless7_ctc/ctc_decode.py @@ -44,7 +44,7 @@ Usage: --exp-dir ./pruned_transducer_stateless7_ctc/exp \ --max-duration 600 \ --hlg-scale 0.8 \ - --decoding-method 1best + --decoding-method nbest (4) nbest-rescoring ./pruned_transducer_stateless7_ctc/ctc_decode.py \ diff --git a/egs/librispeech/ASR/pruned_transducer_stateless7_ctc_bs/ctc_decode.py b/egs/librispeech/ASR/pruned_transducer_stateless7_ctc_bs/ctc_decode.py index 0ef733226..f137485b2 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless7_ctc_bs/ctc_decode.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless7_ctc_bs/ctc_decode.py @@ -42,7 +42,7 @@ Usage: --exp-dir ./pruned_transducer_stateless7_ctc_bs/exp \ --max-duration 600 \ --hlg-scale 0.8 \ - --decoding-method 1best + --decoding-method nbest (4) nbest-rescoring ./pruned_transducer_stateless7_ctc_bs/ctc_decode.py \ --epoch 30 \