mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-10 01:24:19 +00:00
resolve conflicts
This commit is contained in:
commit
3e11b98976
@ -531,16 +531,36 @@ First, let us install a modified version of ``ncnn``:
|
|||||||
git clone https://github.com/csukuangfj/ncnn
|
git clone https://github.com/csukuangfj/ncnn
|
||||||
cd ncnn
|
cd ncnn
|
||||||
git submodule update --recursive --init
|
git submodule update --recursive --init
|
||||||
python3 setup.py bdist_wheel
|
|
||||||
ls -lh dist/
|
# Note: We don't use "python setup.py install" or "pip install ." here
|
||||||
pip install ./dist/*.whl
|
|
||||||
|
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
|
# now build pnnx
|
||||||
cd tools/pnnx
|
cd tools/pnnx
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
cmake ..
|
||||||
make -j4
|
make -j4
|
||||||
export PATH=$PWD/src:$PATH
|
|
||||||
|
|
||||||
./src/pnnx
|
./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
|
We assume that you have added the path to the binary ``pnnx`` to the
|
||||||
environment variable ``PATH``.
|
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
|
Second, let us export the model using ``torch.jit.trace()`` that is suitable
|
||||||
for ``pnnx``:
|
for ``pnnx``:
|
||||||
|
|
||||||
|
@ -1512,24 +1512,6 @@ class EmformerEncoder(nn.Module):
|
|||||||
)
|
)
|
||||||
return states
|
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):
|
class Emformer(EncoderInterface):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -44,7 +44,7 @@ Usage:
|
|||||||
--exp-dir ./pruned_transducer_stateless7_ctc/exp \
|
--exp-dir ./pruned_transducer_stateless7_ctc/exp \
|
||||||
--max-duration 600 \
|
--max-duration 600 \
|
||||||
--hlg-scale 0.8 \
|
--hlg-scale 0.8 \
|
||||||
--decoding-method 1best
|
--decoding-method nbest
|
||||||
|
|
||||||
(4) nbest-rescoring
|
(4) nbest-rescoring
|
||||||
./pruned_transducer_stateless7_ctc/ctc_decode.py \
|
./pruned_transducer_stateless7_ctc/ctc_decode.py \
|
||||||
|
@ -42,7 +42,7 @@ Usage:
|
|||||||
--exp-dir ./pruned_transducer_stateless7_ctc_bs/exp \
|
--exp-dir ./pruned_transducer_stateless7_ctc_bs/exp \
|
||||||
--max-duration 600 \
|
--max-duration 600 \
|
||||||
--hlg-scale 0.8 \
|
--hlg-scale 0.8 \
|
||||||
--decoding-method 1best
|
--decoding-method nbest
|
||||||
(4) nbest-rescoring
|
(4) nbest-rescoring
|
||||||
./pruned_transducer_stateless7_ctc_bs/ctc_decode.py \
|
./pruned_transducer_stateless7_ctc_bs/ctc_decode.py \
|
||||||
--epoch 30 \
|
--epoch 30 \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user