mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 10:02:22 +00:00
deploy: 11bff575863064b0d0ee6792b1505a82bff0a5fd
This commit is contained in:
parent
8a499b7db8
commit
c5796e3f9a
@ -21,6 +21,7 @@ speech recognition recipes using `k2 <https://github.com/k2-fsa/k2>`_.
|
|||||||
:caption: Contents:
|
:caption: Contents:
|
||||||
|
|
||||||
installation/index
|
installation/index
|
||||||
|
model-export/index
|
||||||
recipes/index
|
recipes/index
|
||||||
contributing/index
|
contributing/index
|
||||||
huggingface/index
|
huggingface/index
|
||||||
|
135
_sources/model-export/export-model-state-dict.rst.txt
Normal file
135
_sources/model-export/export-model-state-dict.rst.txt
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
Export model.state_dict()
|
||||||
|
=========================
|
||||||
|
|
||||||
|
When to use it
|
||||||
|
--------------
|
||||||
|
|
||||||
|
During model training, we save checkpoints periodically to disk.
|
||||||
|
|
||||||
|
A checkpoint contains the following information:
|
||||||
|
|
||||||
|
- ``model.state_dict()``
|
||||||
|
- ``optimizer.state_dict()``
|
||||||
|
- and some other information related to training
|
||||||
|
|
||||||
|
When we need to resume the training process from some point, we need a checkpoint.
|
||||||
|
However, if we want to publish the model for inference, then only
|
||||||
|
``model.state_dict()`` is needed. In this case, we need to strip all other information
|
||||||
|
except ``model.state_dict()`` to reduce the file size of the published model.
|
||||||
|
|
||||||
|
How to export
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Every recipe contains a file ``export.py`` that you can use to
|
||||||
|
export ``model.state_dict()`` by taking some checkpoints as inputs.
|
||||||
|
|
||||||
|
.. hint::
|
||||||
|
|
||||||
|
Each ``export.py`` contains well-documented usage information.
|
||||||
|
|
||||||
|
In the following, we use
|
||||||
|
`<https://github.com/k2-fsa/icefall/blob/master/egs/librispeech/ASR/pruned_transducer_stateless3/export.py>`_
|
||||||
|
as an example.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
The steps for other recipes are almost the same.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/export.py \
|
||||||
|
--exp-dir ./pruned_transducer_stateless3/exp \
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model \
|
||||||
|
--epoch 20 \
|
||||||
|
--avg 10
|
||||||
|
|
||||||
|
will generate a file ``pruned_transducer_stateless3/exp/pretrained.pt``, which
|
||||||
|
is a dict containing ``{"model": model.state_dict()}`` saved by ``torch.save()``.
|
||||||
|
|
||||||
|
How to use the exported model
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
For each recipe, we provide pretrained models hosted on huggingface.
|
||||||
|
You can find links to pretrained models in ``RESULTS.md`` of each dataset.
|
||||||
|
|
||||||
|
In the following, we demonstrate how to use the pretrained model from
|
||||||
|
`<https://huggingface.co/csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13>`_.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
|
||||||
|
git lfs install
|
||||||
|
git clone https://huggingface.co/csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13
|
||||||
|
|
||||||
|
After cloning the repo with ``git lfs``, you will find several files in the folder
|
||||||
|
``icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp``
|
||||||
|
that have a prefix ``pretrained-``. Those files contain ``model.state_dict()``
|
||||||
|
exported by the above ``export.py``.
|
||||||
|
|
||||||
|
In each recipe, there is also a file ``pretrained.py``, which can use
|
||||||
|
``pretrained-xxx.pt`` to decode waves. The following is an example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/pretrained.py \
|
||||||
|
--checkpoint ./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/pretrained-iter-1224000-avg-14.pt \
|
||||||
|
--bpe-model ./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/data/lang_bpe_500/bpe.model \
|
||||||
|
--method greedy_search \
|
||||||
|
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1089-134686-0001.wav \
|
||||||
|
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1221-135766-0001.wav \
|
||||||
|
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1221-135766-0002.wav
|
||||||
|
|
||||||
|
The above commands show how to use the exported model with ``pretrained.py`` to
|
||||||
|
decode multiple sound files. Its output is given as follows for reference:
|
||||||
|
|
||||||
|
.. literalinclude:: ./code/export-model-state-dict-pretrained-out.txt
|
||||||
|
|
||||||
|
Use the exported model to run decode.py
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
When we publish the model, we always note down its WERs on some test
|
||||||
|
dataset in ``RESULTS.md``. This section describes how to use the
|
||||||
|
pretrained model to reproduce the WER.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
git lfs install
|
||||||
|
git clone https://huggingface.co/csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13
|
||||||
|
|
||||||
|
cd icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp
|
||||||
|
ln -s pretrained-iter-1224000-avg-14.pt epoch-9999.pt
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
We create a symlink with name ``epoch-9999.pt`` to ``pretrained-iter-1224000-avg-14.pt``,
|
||||||
|
so that we can pass ``--epoch 9999 --avg 1`` to ``decode.py`` in the following
|
||||||
|
command:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/decode.py \
|
||||||
|
--epoch 9999 \
|
||||||
|
--avg 1 \
|
||||||
|
--exp-dir ./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp \
|
||||||
|
--lang-dir ./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/data/lang_bpe_500 \
|
||||||
|
--max-duration 600 \
|
||||||
|
--decoding-method greedy_search
|
||||||
|
|
||||||
|
You will find the decoding results in
|
||||||
|
``./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/greedy_search``.
|
||||||
|
|
||||||
|
.. caution::
|
||||||
|
|
||||||
|
For some recipes, you also need to pass ``--use-averaged-model False``
|
||||||
|
to ``decode.py``. The reason is that the exported pretrained model is already
|
||||||
|
the averaged one.
|
||||||
|
|
||||||
|
.. hint::
|
||||||
|
|
||||||
|
Before running ``decode.py``, we assume that you have already run
|
||||||
|
``prepare.sh`` to prepare the test dataset.
|
12
_sources/model-export/export-ncnn.rst.txt
Normal file
12
_sources/model-export/export-ncnn.rst.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Export to ncnn
|
||||||
|
==============
|
||||||
|
|
||||||
|
We support exporting LSTM transducer models to `ncnn <https://github.com/tencent/ncnn>`_.
|
||||||
|
|
||||||
|
Please refer to :ref:`export-model-for-ncnn` for details.
|
||||||
|
|
||||||
|
We also provide `<https://github.com/k2-fsa/sherpa-ncnn>`_
|
||||||
|
performing speech recognition using ``ncnn`` with exported models.
|
||||||
|
It has been tested on Linux, macOS, Windows, and Raspberry Pi. The project is
|
||||||
|
self-contained and can be statically linked to produce a binary containing
|
||||||
|
everything needed.
|
69
_sources/model-export/export-onnx.rst.txt
Normal file
69
_sources/model-export/export-onnx.rst.txt
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
Export to ONNX
|
||||||
|
==============
|
||||||
|
|
||||||
|
In this section, we describe how to export models to ONNX.
|
||||||
|
|
||||||
|
.. hint::
|
||||||
|
|
||||||
|
Only non-streaming conformer transducer models are tested.
|
||||||
|
|
||||||
|
|
||||||
|
When to use it
|
||||||
|
--------------
|
||||||
|
|
||||||
|
It you want to use an inference framework that supports ONNX
|
||||||
|
to run the pretrained model.
|
||||||
|
|
||||||
|
|
||||||
|
How to export
|
||||||
|
-------------
|
||||||
|
|
||||||
|
We use
|
||||||
|
`<https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless3>`_
|
||||||
|
as an example in the following.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
epoch=14
|
||||||
|
avg=2
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/export.py \
|
||||||
|
--exp-dir ./pruned_transducer_stateless3/exp \
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model \
|
||||||
|
--epoch $epoch \
|
||||||
|
--avg $avg \
|
||||||
|
--onnx 1
|
||||||
|
|
||||||
|
It will generate the following files inside ``pruned_transducer_stateless3/exp``:
|
||||||
|
|
||||||
|
- ``encoder.onnx``
|
||||||
|
- ``decoder.onnx``
|
||||||
|
- ``joiner.onnx``
|
||||||
|
- ``joiner_encoder_proj.onnx``
|
||||||
|
- ``joiner_decoder_proj.onnx``
|
||||||
|
|
||||||
|
You can use ``./pruned_transducer_stateless3/exp/onnx_pretrained.py`` to decode
|
||||||
|
waves with the generated files:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/onnx_pretrained.py \
|
||||||
|
--bpe-model ./data/lang_bpe_500/bpe.model \
|
||||||
|
--encoder-model-filename ./pruned_transducer_stateless3/exp/encoder.onnx \
|
||||||
|
--decoder-model-filename ./pruned_transducer_stateless3/exp/decoder.onnx \
|
||||||
|
--joiner-model-filename ./pruned_transducer_stateless3/exp/joiner.onnx \
|
||||||
|
--joiner-encoder-proj-model-filename ./pruned_transducer_stateless3/exp/joiner_encoder_proj.onnx \
|
||||||
|
--joiner-decoder-proj-model-filename ./pruned_transducer_stateless3/exp/joiner_decoder_proj.onnx \
|
||||||
|
/path/to/foo.wav \
|
||||||
|
/path/to/bar.wav \
|
||||||
|
/path/to/baz.wav
|
||||||
|
|
||||||
|
|
||||||
|
How to use the exported model
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
We also provide `<https://github.com/k2-fsa/sherpa-onnx>`_
|
||||||
|
performing speech recognition using `onnxruntime <https://github.com/microsoft/onnxruntime>`_
|
||||||
|
with exported models.
|
||||||
|
It has been tested on Linux, macOS, and Windows.
|
58
_sources/model-export/export-with-torch-jit-script.rst.txt
Normal file
58
_sources/model-export/export-with-torch-jit-script.rst.txt
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
.. _export-model-with-torch-jit-script:
|
||||||
|
|
||||||
|
Export model with torch.jit.script()
|
||||||
|
===================================
|
||||||
|
|
||||||
|
In this section, we describe how to export a model via
|
||||||
|
``torch.jit.script()``.
|
||||||
|
|
||||||
|
When to use it
|
||||||
|
--------------
|
||||||
|
|
||||||
|
If we want to use our trained model with torchscript,
|
||||||
|
we can use ``torch.jit.script()``.
|
||||||
|
|
||||||
|
.. hint::
|
||||||
|
|
||||||
|
See :ref:`export-model-with-torch-jit-trace`
|
||||||
|
if you want to use ``torch.jit.trace()``.
|
||||||
|
|
||||||
|
How to export
|
||||||
|
-------------
|
||||||
|
|
||||||
|
We use
|
||||||
|
`<https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless3>`_
|
||||||
|
as an example in the following.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
epoch=14
|
||||||
|
avg=1
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/export.py \
|
||||||
|
--exp-dir ./pruned_transducer_stateless3/exp \
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model \
|
||||||
|
--epoch $epoch \
|
||||||
|
--avg $avg \
|
||||||
|
--jit 1
|
||||||
|
|
||||||
|
It will generate a file ``cpu_jit.pt`` in ``pruned_transducer_stateless3/exp``.
|
||||||
|
|
||||||
|
.. caution::
|
||||||
|
|
||||||
|
Don't be confused by ``cpu`` in ``cpu_jit.pt``. We move all parameters
|
||||||
|
to CPU before saving it into a ``pt`` file; that's why we use ``cpu``
|
||||||
|
in the filename.
|
||||||
|
|
||||||
|
How to use the exported model
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Please refer to the following pages for usage:
|
||||||
|
|
||||||
|
- `<https://k2-fsa.github.io/sherpa/python/streaming_asr/emformer/index.html>`_
|
||||||
|
- `<https://k2-fsa.github.io/sherpa/python/streaming_asr/conv_emformer/index.html>`_
|
||||||
|
- `<https://k2-fsa.github.io/sherpa/python/streaming_asr/conformer/index.html>`_
|
||||||
|
- `<https://k2-fsa.github.io/sherpa/python/offline_asr/conformer/index.html>`_
|
||||||
|
- `<https://k2-fsa.github.io/sherpa/cpp/offline_asr/gigaspeech.html>`_
|
||||||
|
- `<https://k2-fsa.github.io/sherpa/cpp/offline_asr/wenetspeech.html>`_
|
69
_sources/model-export/export-with-torch-jit-trace.rst.txt
Normal file
69
_sources/model-export/export-with-torch-jit-trace.rst.txt
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
.. _export-model-with-torch-jit-trace:
|
||||||
|
|
||||||
|
Export model with torch.jit.trace()
|
||||||
|
===================================
|
||||||
|
|
||||||
|
In this section, we describe how to export a model via
|
||||||
|
``torch.jit.trace()``.
|
||||||
|
|
||||||
|
When to use it
|
||||||
|
--------------
|
||||||
|
|
||||||
|
If we want to use our trained model with torchscript,
|
||||||
|
we can use ``torch.jit.trace()``.
|
||||||
|
|
||||||
|
.. hint::
|
||||||
|
|
||||||
|
See :ref:`export-model-with-torch-jit-script`
|
||||||
|
if you want to use ``torch.jit.script()``.
|
||||||
|
|
||||||
|
How to export
|
||||||
|
-------------
|
||||||
|
|
||||||
|
We use
|
||||||
|
`<https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/lstm_transducer_stateless2>`_
|
||||||
|
as an example in the following.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
iter=468000
|
||||||
|
avg=16
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
|
||||||
|
./lstm_transducer_stateless2/export.py \
|
||||||
|
--exp-dir ./lstm_transducer_stateless2/exp \
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model \
|
||||||
|
--iter $iter \
|
||||||
|
--avg $avg \
|
||||||
|
--jit-trace 1
|
||||||
|
|
||||||
|
It will generate three files inside ``lstm_transducer_stateless2/exp``:
|
||||||
|
|
||||||
|
- ``encoder_jit_trace.pt``
|
||||||
|
- ``decoder_jit_trace.pt``
|
||||||
|
- ``joiner_jit_trace.pt``
|
||||||
|
|
||||||
|
You can use
|
||||||
|
`<https://github.com/k2-fsa/icefall/blob/master/egs/librispeech/ASR/lstm_transducer_stateless2/jit_pretrained.py>`_
|
||||||
|
to decode sound files with the following commands:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd egs/librispeech/ASR
|
||||||
|
./lstm_transducer_stateless2/jit_pretrained.py \
|
||||||
|
--bpe-model ./data/lang_bpe_500/bpe.model \
|
||||||
|
--encoder-model-filename ./lstm_transducer_stateless2/exp/encoder_jit_trace.pt \
|
||||||
|
--decoder-model-filename ./lstm_transducer_stateless2/exp/decoder_jit_trace.pt \
|
||||||
|
--joiner-model-filename ./lstm_transducer_stateless2/exp/joiner_jit_trace.pt \
|
||||||
|
/path/to/foo.wav \
|
||||||
|
/path/to/bar.wav \
|
||||||
|
/path/to/baz.wav
|
||||||
|
|
||||||
|
How to use the exported models
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
Please refer to
|
||||||
|
`<https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/index.html>`_
|
||||||
|
for its usage in `sherpa <https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/index.html>`_.
|
||||||
|
You can also find pretrained models there.
|
14
_sources/model-export/index.rst.txt
Normal file
14
_sources/model-export/index.rst.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Model export
|
||||||
|
============
|
||||||
|
|
||||||
|
In this section, we describe various ways to export models.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
|
||||||
|
export-model-state-dict
|
||||||
|
export-with-torch-jit-trace
|
||||||
|
export-with-torch-jit-script
|
||||||
|
export-onnx
|
||||||
|
export-ncnn
|
@ -515,6 +515,8 @@ To use the generated files with ``./lstm_transducer_stateless2/jit_pretrained``:
|
|||||||
Please see `<https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/english/server.html>`_
|
Please see `<https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/english/server.html>`_
|
||||||
for how to use the exported models in ``sherpa``.
|
for how to use the exported models in ``sherpa``.
|
||||||
|
|
||||||
|
.. _export-model-for-ncnn:
|
||||||
|
|
||||||
Export model for ncnn
|
Export model for ncnn
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="doc.html">Contributing to Documentation</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="doc.html">Contributing to Documentation</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current">
|
||||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">Contributing to Documentation</a></li>
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">Contributing to Documentation</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="doc.html">Contributing to Documentation</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="doc.html">Contributing to Documentation</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Contributing</a><ul>
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Contributing</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="doc.html">Contributing to Documentation</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="doc.html">Contributing to Documentation</a></li>
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="huggingface/index.html">Huggingface</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="huggingface/index.html">Huggingface</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Huggingface</a><ul>
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Huggingface</a><ul>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Huggingface</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Huggingface</a><ul class="current">
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Huggingface</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Huggingface</a><ul class="current">
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="huggingface/index.html">Huggingface</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="huggingface/index.html">Huggingface</a></li>
|
||||||
@ -88,6 +89,14 @@ speech recognition recipes using <a class="reference external" href="https://git
|
|||||||
<li class="toctree-l2"><a class="reference internal" href="installation/index.html#youtube-video">YouTube Video</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="installation/index.html#youtube-video">YouTube Video</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="model-export/index.html">Model export</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="model-export/export-model-state-dict.html">Export model.state_dict()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="model-export/export-with-torch-jit-trace.html">Export model with torch.jit.trace()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="model-export/export-with-torch-jit-script.html">Export model with torch.jit.script()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="model-export/export-onnx.html">Export to ONNX</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="model-export/export-ncnn.html">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="recipes/aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="recipes/aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="recipes/librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="recipes/librispeech/index.html">LibriSpeech</a></li>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<script src="../_static/js/theme.js"></script>
|
<script src="../_static/js/theme.js"></script>
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
<link rel="next" title="Recipes" href="../recipes/index.html" />
|
<link rel="next" title="Model export" href="../model-export/index.html" />
|
||||||
<link rel="prev" title="Icefall" href="../index.html" />
|
<link rel="prev" title="Icefall" href="../index.html" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -63,6 +63,7 @@
|
|||||||
<li class="toctree-l2"><a class="reference internal" href="#youtube-video">YouTube Video</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="#youtube-video">YouTube Video</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
||||||
@ -547,7 +548,7 @@ the following YouTube channel by <a class="reference external" href="https://www
|
|||||||
</div>
|
</div>
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
<a href="../index.html" class="btn btn-neutral float-left" title="Icefall" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
<a href="../index.html" class="btn btn-neutral float-left" title="Icefall" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
<a href="../recipes/index.html" class="btn btn-neutral float-right" title="Recipes" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
<a href="../model-export/index.html" class="btn btn-neutral float-right" title="Model export" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
262
model-export/export-model-state-dict.html
Normal file
262
model-export/export-model-state-dict.html
Normal file
File diff suppressed because one or more lines are too long
125
model-export/export-ncnn.html
Normal file
125
model-export/export-ncnn.html
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Export to ncnn — icefall 0.1 documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/jquery.js"></script>
|
||||||
|
<script src="../_static/underscore.js"></script>
|
||||||
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Recipes" href="../recipes/index.html" />
|
||||||
|
<link rel="prev" title="Export to ONNX" href="export-onnx.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
<a href="../index.html" class="icon icon-home"> icefall
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Model export</a><ul class="current">
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html">Export model.state_dict()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html">Export model with torch.jit.trace()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html">Export model with torch.jit.script()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html">Export to ONNX</a></li>
|
||||||
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">icefall</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||||
|
<li><a href="index.html">Model export</a> »</li>
|
||||||
|
<li>Export to ncnn</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="https://github.com/k2-fsa/icefall/blob/master/icefall/docs/source/model-export/export-ncnn.rst" class="fa fa-github"> Edit on GitHub</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="export-to-ncnn">
|
||||||
|
<h1>Export to ncnn<a class="headerlink" href="#export-to-ncnn" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>We support exporting LSTM transducer models to <a class="reference external" href="https://github.com/tencent/ncnn">ncnn</a>.</p>
|
||||||
|
<p>Please refer to <a class="reference internal" href="../recipes/librispeech/lstm_pruned_stateless_transducer.html#export-model-for-ncnn"><span class="std std-ref">Export model for ncnn</span></a> for details.</p>
|
||||||
|
<p>We also provide <a class="reference external" href="https://github.com/k2-fsa/sherpa-ncnn">https://github.com/k2-fsa/sherpa-ncnn</a>
|
||||||
|
performing speech recognition using <code class="docutils literal notranslate"><span class="pre">ncnn</span></code> with exported models.
|
||||||
|
It has been tested on Linux, macOS, Windows, and Raspberry Pi. The project is
|
||||||
|
self-contained and can be statically linked to produce a binary containing
|
||||||
|
everything needed.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="export-onnx.html" class="btn btn-neutral float-left" title="Export to ONNX" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="../recipes/index.html" class="btn btn-neutral float-right" title="Recipes" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2021, icefall development team.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
182
model-export/export-onnx.html
Normal file
182
model-export/export-onnx.html
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Export to ONNX — icefall 0.1 documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/jquery.js"></script>
|
||||||
|
<script src="../_static/underscore.js"></script>
|
||||||
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Export to ncnn" href="export-ncnn.html" />
|
||||||
|
<link rel="prev" title="Export model with torch.jit.script()" href="export-with-torch-jit-script.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
<a href="../index.html" class="icon icon-home"> icefall
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Model export</a><ul class="current">
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html">Export model.state_dict()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html">Export model with torch.jit.trace()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html">Export model with torch.jit.script()</a></li>
|
||||||
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">Export to ONNX</a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-use-the-exported-model">How to use the exported model</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn.html">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">icefall</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||||
|
<li><a href="index.html">Model export</a> »</li>
|
||||||
|
<li>Export to ONNX</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="https://github.com/k2-fsa/icefall/blob/master/icefall/docs/source/model-export/export-onnx.rst" class="fa fa-github"> Edit on GitHub</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="export-to-onnx">
|
||||||
|
<h1>Export to ONNX<a class="headerlink" href="#export-to-onnx" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>In this section, we describe how to export models to ONNX.</p>
|
||||||
|
<div class="admonition hint">
|
||||||
|
<p class="admonition-title">Hint</p>
|
||||||
|
<p>Only non-streaming conformer transducer models are tested.</p>
|
||||||
|
</div>
|
||||||
|
<section id="when-to-use-it">
|
||||||
|
<h2>When to use it<a class="headerlink" href="#when-to-use-it" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>It you want to use an inference framework that supports ONNX
|
||||||
|
to run the pretrained model.</p>
|
||||||
|
</section>
|
||||||
|
<section id="how-to-export">
|
||||||
|
<h2>How to export<a class="headerlink" href="#how-to-export" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>We use
|
||||||
|
<a class="reference external" href="https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless3">https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless3</a>
|
||||||
|
as an example in the following.</p>
|
||||||
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> egs/librispeech/ASR
|
||||||
|
<span class="nv">epoch</span><span class="o">=</span><span class="m">14</span>
|
||||||
|
<span class="nv">avg</span><span class="o">=</span><span class="m">2</span>
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/export.py <span class="se">\</span>
|
||||||
|
--exp-dir ./pruned_transducer_stateless3/exp <span class="se">\</span>
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model <span class="se">\</span>
|
||||||
|
--epoch <span class="nv">$epoch</span> <span class="se">\</span>
|
||||||
|
--avg <span class="nv">$avg</span> <span class="se">\</span>
|
||||||
|
--onnx <span class="m">1</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>It will generate the following files inside <code class="docutils literal notranslate"><span class="pre">pruned_transducer_stateless3/exp</span></code>:</p>
|
||||||
|
<blockquote>
|
||||||
|
<div><ul class="simple">
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">encoder.onnx</span></code></p></li>
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">decoder.onnx</span></code></p></li>
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">joiner.onnx</span></code></p></li>
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">joiner_encoder_proj.onnx</span></code></p></li>
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">joiner_decoder_proj.onnx</span></code></p></li>
|
||||||
|
</ul>
|
||||||
|
</div></blockquote>
|
||||||
|
<p>You can use <code class="docutils literal notranslate"><span class="pre">./pruned_transducer_stateless3/exp/onnx_pretrained.py</span></code> to decode
|
||||||
|
waves with the generated files:</p>
|
||||||
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./pruned_transducer_stateless3/onnx_pretrained.py <span class="se">\</span>
|
||||||
|
--bpe-model ./data/lang_bpe_500/bpe.model <span class="se">\</span>
|
||||||
|
--encoder-model-filename ./pruned_transducer_stateless3/exp/encoder.onnx <span class="se">\</span>
|
||||||
|
--decoder-model-filename ./pruned_transducer_stateless3/exp/decoder.onnx <span class="se">\</span>
|
||||||
|
--joiner-model-filename ./pruned_transducer_stateless3/exp/joiner.onnx <span class="se">\</span>
|
||||||
|
--joiner-encoder-proj-model-filename ./pruned_transducer_stateless3/exp/joiner_encoder_proj.onnx <span class="se">\</span>
|
||||||
|
--joiner-decoder-proj-model-filename ./pruned_transducer_stateless3/exp/joiner_decoder_proj.onnx <span class="se">\</span>
|
||||||
|
/path/to/foo.wav <span class="se">\</span>
|
||||||
|
/path/to/bar.wav <span class="se">\</span>
|
||||||
|
/path/to/baz.wav
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="how-to-use-the-exported-model">
|
||||||
|
<h2>How to use the exported model<a class="headerlink" href="#how-to-use-the-exported-model" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>We also provide <a class="reference external" href="https://github.com/k2-fsa/sherpa-onnx">https://github.com/k2-fsa/sherpa-onnx</a>
|
||||||
|
performing speech recognition using <a class="reference external" href="https://github.com/microsoft/onnxruntime">onnxruntime</a>
|
||||||
|
with exported models.
|
||||||
|
It has been tested on Linux, macOS, and Windows.</p>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="export-with-torch-jit-script.html" class="btn btn-neutral float-left" title="Export model with torch.jit.script()" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="export-ncnn.html" class="btn btn-neutral float-right" title="Export to ncnn" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2021, icefall development team.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
172
model-export/export-with-torch-jit-script.html
Normal file
172
model-export/export-with-torch-jit-script.html
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Export model with torch.jit.script() — icefall 0.1 documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/jquery.js"></script>
|
||||||
|
<script src="../_static/underscore.js"></script>
|
||||||
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Export to ONNX" href="export-onnx.html" />
|
||||||
|
<link rel="prev" title="Export model with torch.jit.trace()" href="export-with-torch-jit-trace.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
<a href="../index.html" class="icon icon-home"> icefall
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Model export</a><ul class="current">
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html">Export model.state_dict()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html">Export model with torch.jit.trace()</a></li>
|
||||||
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">Export model with torch.jit.script()</a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-use-the-exported-model">How to use the exported model</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html">Export to ONNX</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn.html">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">icefall</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||||
|
<li><a href="index.html">Model export</a> »</li>
|
||||||
|
<li>Export model with torch.jit.script()</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="https://github.com/k2-fsa/icefall/blob/master/icefall/docs/source/model-export/export-with-torch-jit-script.rst" class="fa fa-github"> Edit on GitHub</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="export-model-with-torch-jit-script">
|
||||||
|
<span id="id1"></span><h1>Export model with torch.jit.script()<a class="headerlink" href="#export-model-with-torch-jit-script" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>In this section, we describe how to export a model via
|
||||||
|
<code class="docutils literal notranslate"><span class="pre">torch.jit.script()</span></code>.</p>
|
||||||
|
<section id="when-to-use-it">
|
||||||
|
<h2>When to use it<a class="headerlink" href="#when-to-use-it" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>If we want to use our trained model with torchscript,
|
||||||
|
we can use <code class="docutils literal notranslate"><span class="pre">torch.jit.script()</span></code>.</p>
|
||||||
|
<div class="admonition hint">
|
||||||
|
<p class="admonition-title">Hint</p>
|
||||||
|
<p>See <a class="reference internal" href="export-with-torch-jit-trace.html#export-model-with-torch-jit-trace"><span class="std std-ref">Export model with torch.jit.trace()</span></a>
|
||||||
|
if you want to use <code class="docutils literal notranslate"><span class="pre">torch.jit.trace()</span></code>.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="how-to-export">
|
||||||
|
<h2>How to export<a class="headerlink" href="#how-to-export" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>We use
|
||||||
|
<a class="reference external" href="https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless3">https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless3</a>
|
||||||
|
as an example in the following.</p>
|
||||||
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> egs/librispeech/ASR
|
||||||
|
<span class="nv">epoch</span><span class="o">=</span><span class="m">14</span>
|
||||||
|
<span class="nv">avg</span><span class="o">=</span><span class="m">1</span>
|
||||||
|
|
||||||
|
./pruned_transducer_stateless3/export.py <span class="se">\</span>
|
||||||
|
--exp-dir ./pruned_transducer_stateless3/exp <span class="se">\</span>
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model <span class="se">\</span>
|
||||||
|
--epoch <span class="nv">$epoch</span> <span class="se">\</span>
|
||||||
|
--avg <span class="nv">$avg</span> <span class="se">\</span>
|
||||||
|
--jit <span class="m">1</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>It will generate a file <code class="docutils literal notranslate"><span class="pre">cpu_jit.pt</span></code> in <code class="docutils literal notranslate"><span class="pre">pruned_transducer_stateless3/exp</span></code>.</p>
|
||||||
|
<div class="admonition caution">
|
||||||
|
<p class="admonition-title">Caution</p>
|
||||||
|
<p>Don’t be confused by <code class="docutils literal notranslate"><span class="pre">cpu</span></code> in <code class="docutils literal notranslate"><span class="pre">cpu_jit.pt</span></code>. We move all parameters
|
||||||
|
to CPU before saving it into a <code class="docutils literal notranslate"><span class="pre">pt</span></code> file; that’s why we use <code class="docutils literal notranslate"><span class="pre">cpu</span></code>
|
||||||
|
in the filename.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="how-to-use-the-exported-model">
|
||||||
|
<h2>How to use the exported model<a class="headerlink" href="#how-to-use-the-exported-model" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>Please refer to the following pages for usage:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/python/streaming_asr/emformer/index.html">https://k2-fsa.github.io/sherpa/python/streaming_asr/emformer/index.html</a></p></li>
|
||||||
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/python/streaming_asr/conv_emformer/index.html">https://k2-fsa.github.io/sherpa/python/streaming_asr/conv_emformer/index.html</a></p></li>
|
||||||
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/python/streaming_asr/conformer/index.html">https://k2-fsa.github.io/sherpa/python/streaming_asr/conformer/index.html</a></p></li>
|
||||||
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/python/offline_asr/conformer/index.html">https://k2-fsa.github.io/sherpa/python/offline_asr/conformer/index.html</a></p></li>
|
||||||
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/cpp/offline_asr/gigaspeech.html">https://k2-fsa.github.io/sherpa/cpp/offline_asr/gigaspeech.html</a></p></li>
|
||||||
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/cpp/offline_asr/wenetspeech.html">https://k2-fsa.github.io/sherpa/cpp/offline_asr/wenetspeech.html</a></p></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="export-with-torch-jit-trace.html" class="btn btn-neutral float-left" title="Export model with torch.jit.trace()" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="export-onnx.html" class="btn btn-neutral float-right" title="Export to ONNX" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2021, icefall development team.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
183
model-export/export-with-torch-jit-trace.html
Normal file
183
model-export/export-with-torch-jit-trace.html
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Export model with torch.jit.trace() — icefall 0.1 documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/jquery.js"></script>
|
||||||
|
<script src="../_static/underscore.js"></script>
|
||||||
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Export model with torch.jit.script()" href="export-with-torch-jit-script.html" />
|
||||||
|
<link rel="prev" title="Export model.state_dict()" href="export-model-state-dict.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
<a href="../index.html" class="icon icon-home"> icefall
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Model export</a><ul class="current">
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html">Export model.state_dict()</a></li>
|
||||||
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">Export model with torch.jit.trace()</a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-use-the-exported-models">How to use the exported models</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html">Export model with torch.jit.script()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html">Export to ONNX</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn.html">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">icefall</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||||
|
<li><a href="index.html">Model export</a> »</li>
|
||||||
|
<li>Export model with torch.jit.trace()</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="https://github.com/k2-fsa/icefall/blob/master/icefall/docs/source/model-export/export-with-torch-jit-trace.rst" class="fa fa-github"> Edit on GitHub</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="export-model-with-torch-jit-trace">
|
||||||
|
<span id="id1"></span><h1>Export model with torch.jit.trace()<a class="headerlink" href="#export-model-with-torch-jit-trace" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>In this section, we describe how to export a model via
|
||||||
|
<code class="docutils literal notranslate"><span class="pre">torch.jit.trace()</span></code>.</p>
|
||||||
|
<section id="when-to-use-it">
|
||||||
|
<h2>When to use it<a class="headerlink" href="#when-to-use-it" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>If we want to use our trained model with torchscript,
|
||||||
|
we can use <code class="docutils literal notranslate"><span class="pre">torch.jit.trace()</span></code>.</p>
|
||||||
|
<div class="admonition hint">
|
||||||
|
<p class="admonition-title">Hint</p>
|
||||||
|
<p>See <a class="reference internal" href="export-with-torch-jit-script.html#export-model-with-torch-jit-script"><span class="std std-ref">Export model with torch.jit.script()</span></a>
|
||||||
|
if you want to use <code class="docutils literal notranslate"><span class="pre">torch.jit.script()</span></code>.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="how-to-export">
|
||||||
|
<h2>How to export<a class="headerlink" href="#how-to-export" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>We use
|
||||||
|
<a class="reference external" href="https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/lstm_transducer_stateless2">https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/lstm_transducer_stateless2</a>
|
||||||
|
as an example in the following.</p>
|
||||||
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">iter</span><span class="o">=</span><span class="m">468000</span>
|
||||||
|
<span class="nv">avg</span><span class="o">=</span><span class="m">16</span>
|
||||||
|
|
||||||
|
<span class="nb">cd</span> egs/librispeech/ASR
|
||||||
|
|
||||||
|
./lstm_transducer_stateless2/export.py <span class="se">\</span>
|
||||||
|
--exp-dir ./lstm_transducer_stateless2/exp <span class="se">\</span>
|
||||||
|
--bpe-model data/lang_bpe_500/bpe.model <span class="se">\</span>
|
||||||
|
--iter <span class="nv">$iter</span> <span class="se">\</span>
|
||||||
|
--avg <span class="nv">$avg</span> <span class="se">\</span>
|
||||||
|
--jit-trace <span class="m">1</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>It will generate three files inside <code class="docutils literal notranslate"><span class="pre">lstm_transducer_stateless2/exp</span></code>:</p>
|
||||||
|
<blockquote>
|
||||||
|
<div><ul class="simple">
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">encoder_jit_trace.pt</span></code></p></li>
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">decoder_jit_trace.pt</span></code></p></li>
|
||||||
|
<li><p><code class="docutils literal notranslate"><span class="pre">joiner_jit_trace.pt</span></code></p></li>
|
||||||
|
</ul>
|
||||||
|
</div></blockquote>
|
||||||
|
<p>You can use
|
||||||
|
<a class="reference external" href="https://github.com/k2-fsa/icefall/blob/master/egs/librispeech/ASR/lstm_transducer_stateless2/jit_pretrained.py">https://github.com/k2-fsa/icefall/blob/master/egs/librispeech/ASR/lstm_transducer_stateless2/jit_pretrained.py</a>
|
||||||
|
to decode sound files with the following commands:</p>
|
||||||
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> egs/librispeech/ASR
|
||||||
|
./lstm_transducer_stateless2/jit_pretrained.py <span class="se">\</span>
|
||||||
|
--bpe-model ./data/lang_bpe_500/bpe.model <span class="se">\</span>
|
||||||
|
--encoder-model-filename ./lstm_transducer_stateless2/exp/encoder_jit_trace.pt <span class="se">\</span>
|
||||||
|
--decoder-model-filename ./lstm_transducer_stateless2/exp/decoder_jit_trace.pt <span class="se">\</span>
|
||||||
|
--joiner-model-filename ./lstm_transducer_stateless2/exp/joiner_jit_trace.pt <span class="se">\</span>
|
||||||
|
/path/to/foo.wav <span class="se">\</span>
|
||||||
|
/path/to/bar.wav <span class="se">\</span>
|
||||||
|
/path/to/baz.wav
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="how-to-use-the-exported-models">
|
||||||
|
<h2>How to use the exported models<a class="headerlink" href="#how-to-use-the-exported-models" title="Permalink to this heading"></a></h2>
|
||||||
|
<p>Please refer to
|
||||||
|
<a class="reference external" href="https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/index.html">https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/index.html</a>
|
||||||
|
for its usage in <a class="reference external" href="https://k2-fsa.github.io/sherpa/python/streaming_asr/lstm/index.html">sherpa</a>.
|
||||||
|
You can also find pretrained models there.</p>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="export-model-state-dict.html" class="btn btn-neutral float-left" title="Export model.state_dict()" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="export-with-torch-jit-script.html" class="btn btn-neutral float-right" title="Export model with torch.jit.script()" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2021, icefall development team.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
148
model-export/index.html
Normal file
148
model-export/index.html
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Model export — icefall 0.1 documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/jquery.js"></script>
|
||||||
|
<script src="../_static/underscore.js"></script>
|
||||||
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Export model.state_dict()" href="export-model-state-dict.html" />
|
||||||
|
<link rel="prev" title="Installation" href="../installation/index.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
<a href="../index.html" class="icon icon-home"> icefall
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Model export</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html">Export model.state_dict()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html">Export model with torch.jit.trace()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html">Export model with torch.jit.script()</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html">Export to ONNX</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn.html">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../huggingface/index.html">Huggingface</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">icefall</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||||||
|
<li>Model export</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="https://github.com/k2-fsa/icefall/blob/master/icefall/docs/source/model-export/index.rst" class="fa fa-github"> Edit on GitHub</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="model-export">
|
||||||
|
<h1>Model export<a class="headerlink" href="#model-export" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>In this section, we describe various ways to export models.</p>
|
||||||
|
<div class="toctree-wrapper compound">
|
||||||
|
<ul>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="export-model-state-dict.html">Export model.state_dict()</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html#how-to-use-the-exported-model">How to use the exported model</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-model-state-dict.html#use-the-exported-model-to-run-decode-py">Use the exported model to run decode.py</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="export-with-torch-jit-trace.html">Export model with torch.jit.trace()</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-trace.html#how-to-use-the-exported-models">How to use the exported models</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="export-with-torch-jit-script.html">Export model with torch.jit.script()</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-with-torch-jit-script.html#how-to-use-the-exported-model">How to use the exported model</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="export-onnx.html">Export to ONNX</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html#when-to-use-it">When to use it</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html#how-to-export">How to export</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="export-onnx.html#how-to-use-the-exported-model">How to use the exported model</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="export-ncnn.html">Export to ncnn</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="../installation/index.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="export-model-state-dict.html" class="btn btn-neutral float-right" title="Export model.state_dict()" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2021, icefall development team.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
objects.inv
BIN
objects.inv
Binary file not shown.
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html">aishell</a><ul class="current">
|
<li class="toctree-l2 current"><a class="reference internal" href="index.html">aishell</a><ul class="current">
|
||||||
<li class="toctree-l3"><a class="reference internal" href="tdnn_lstm_ctc.html">TDNN-LSTM CTC</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="tdnn_lstm_ctc.html">TDNN-LSTM CTC</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">aishell</a><ul>
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">aishell</a><ul>
|
||||||
<li class="toctree-l3"><a class="reference internal" href="tdnn_lstm_ctc.html">TDNN-LSTM CTC</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="tdnn_lstm_ctc.html">TDNN-LSTM CTC</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html">aishell</a><ul class="current">
|
<li class="toctree-l2 current"><a class="reference internal" href="index.html">aishell</a><ul class="current">
|
||||||
<li class="toctree-l3"><a class="reference internal" href="tdnn_lstm_ctc.html">TDNN-LSTM CTC</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="tdnn_lstm_ctc.html">TDNN-LSTM CTC</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html">aishell</a><ul class="current">
|
<li class="toctree-l2 current"><a class="reference internal" href="index.html">aishell</a><ul class="current">
|
||||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">TDNN-LSTM CTC</a><ul>
|
<li class="toctree-l3 current"><a class="current reference internal" href="#">TDNN-LSTM CTC</a><ul>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<link rel="index" title="Index" href="../genindex.html" />
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
<link rel="next" title="aishell" href="aishell/index.html" />
|
<link rel="next" title="aishell" href="aishell/index.html" />
|
||||||
<link rel="prev" title="Installation" href="../installation/index.html" />
|
<link rel="prev" title="Export to ncnn" href="../model-export/export-ncnn.html" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
<body class="wy-body-for-nav">
|
||||||
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Recipes</a><ul>
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Recipes</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="librispeech/index.html">LibriSpeech</a></li>
|
||||||
@ -114,7 +115,7 @@ Currently, only speech recognition recipes are provided.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
<a href="../installation/index.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
<a href="../model-export/export-ncnn.html" class="btn btn-neutral float-left" title="Export to ncnn" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
<a href="aishell/index.html" class="btn btn-neutral float-right" title="aishell" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
<a href="aishell/index.html" class="btn btn-neutral float-right" title="aishell" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html">LibriSpeech</a><ul class="current">
|
<li class="toctree-l2 current"><a class="reference internal" href="index.html">LibriSpeech</a><ul class="current">
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2 current"><a class="current reference internal" href="#">LibriSpeech</a><ul>
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">LibriSpeech</a><ul>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html">LibriSpeech</a><ul class="current">
|
<li class="toctree-l2 current"><a class="reference internal" href="index.html">LibriSpeech</a><ul class="current">
|
||||||
@ -376,10 +377,10 @@ $ tensorboard dev upload --logdir . --description <span class="s2">"LSTM tr
|
|||||||
<p>Note there is a URL in the above output. Click it and you will see
|
<p>Note there is a URL in the above output. Click it and you will see
|
||||||
the following screenshot:</p>
|
the following screenshot:</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<div><figure class="align-center" id="id2">
|
<div><figure class="align-center" id="id3">
|
||||||
<a class="reference external image-reference" href="https://tensorboard.dev/experiment/lzGnETjwRxC3yghNMd4kPw/"><img alt="TensorBoard screenshot" src="../../_images/librispeech-lstm-transducer-tensorboard-log.png" style="width: 600px;" /></a>
|
<a class="reference external image-reference" href="https://tensorboard.dev/experiment/lzGnETjwRxC3yghNMd4kPw/"><img alt="TensorBoard screenshot" src="../../_images/librispeech-lstm-transducer-tensorboard-log.png" style="width: 600px;" /></a>
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<p><span class="caption-number">Fig. 5 </span><span class="caption-text">TensorBoard screenshot.</span><a class="headerlink" href="#id2" title="Permalink to this image"></a></p>
|
<p><span class="caption-number">Fig. 5 </span><span class="caption-text">TensorBoard screenshot.</span><a class="headerlink" href="#id3" title="Permalink to this image"></a></p>
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
</div></blockquote>
|
</div></blockquote>
|
||||||
@ -584,7 +585,7 @@ for how to use the exported models in <code class="docutils literal notranslate"
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section id="export-model-for-ncnn">
|
<section id="export-model-for-ncnn">
|
||||||
<h3>Export model for ncnn<a class="headerlink" href="#export-model-for-ncnn" title="Permalink to this heading"></a></h3>
|
<span id="id2"></span><h3>Export model for ncnn<a class="headerlink" href="#export-model-for-ncnn" title="Permalink to this heading"></a></h3>
|
||||||
<p>We support exporting pretrained LSTM transducer models to
|
<p>We support exporting pretrained LSTM transducer models to
|
||||||
<a class="reference external" href="https://github.com/tencent/ncnn">ncnn</a> using
|
<a class="reference external" href="https://github.com/tencent/ncnn">ncnn</a> using
|
||||||
<a class="reference external" href="https://github.com/Tencent/ncnn/tree/master/tools/pnnx">pnnx</a>.</p>
|
<a class="reference external" href="https://github.com/Tencent/ncnn/tree/master/tools/pnnx">pnnx</a>.</p>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html">LibriSpeech</a><ul class="current">
|
<li class="toctree-l2 current"><a class="reference internal" href="index.html">LibriSpeech</a><ul class="current">
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul class="current">
|
<ul class="current">
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Recipes</a><ul class="current">
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../aishell/index.html">aishell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="../librispeech/index.html">LibriSpeech</a></li>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="model-export/index.html">Model export</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="recipes/index.html">Recipes</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="contributing/index.html">Contributing</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="contributing/index.html">Contributing</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="huggingface/index.html">Huggingface</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="huggingface/index.html">Huggingface</a></li>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user