mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 10:02:22 +00:00
202 lines
13 KiB
HTML
202 lines
13 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<html class="writer-html5" lang="en">
|
|
<head>
|
|
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Export to ncnn — icefall 0.1 documentation</title>
|
|
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
|
|
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=e59714d7" />
|
|
|
|
|
|
<script src="../_static/jquery.js?v=5d32c60e"></script>
|
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js?v=e031e9a9"></script>
|
|
<script src="../_static/doctools.js?v=888ff710"></script>
|
|
<script src="../_static/sphinx_highlight.js?v=4825356b"></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 streaming Zipformer transducer models to ncnn" href="export-ncnn-zipformer.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" aria-label="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="../for-dummies/index.html">Icefall for dummies tutorial</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="../docker/index.html">Docker</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../faqs.html">Frequently Asked Questions (FAQs)</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><ul>
|
|
<li class="toctree-l3"><a class="reference internal" href="export-ncnn-zipformer.html">Export streaming Zipformer transducer models to ncnn</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="export-ncnn-conv-emformer.html">Export ConvEmformer transducer models to ncnn</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="export-ncnn-lstm.html">Export LSTM transducer models to ncnn</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../fst-based-forced-alignment/index.html">FST-based forced alignment</a></li>
|
|
</ul>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../recipes/index.html">Recipes</a></li>
|
|
</ul>
|
|
<ul>
|
|
<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>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../decoding-with-langugage-models/index.html">Decoding with language models</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" aria-label="Home"></a></li>
|
|
<li class="breadcrumb-item"><a href="index.html">Model export</a></li>
|
|
<li class="breadcrumb-item active">Export to ncnn</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
<a href="https://github.com/k2-fsa/icefall/blob/master/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">
|
|
<span id="icefall-export-to-ncnn"></span><h1>Export to ncnn<a class="headerlink" href="#export-to-ncnn" title="Permalink to this heading"></a></h1>
|
|
<p>We support exporting the following models
|
|
to <a class="reference external" href="https://github.com/tencent/ncnn">ncnn</a>:</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li><p><a class="reference external" href="https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/pruned_transducer_stateless7_streaming">Zipformer transducer models</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/lstm_transducer_stateless2">LSTM transducer models</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/k2-fsa/icefall/tree/master/egs/librispeech/ASR/conv_emformer_transducer_stateless2">ConvEmformer transducer models</a></p></li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<p>We also provide <a class="reference external" href="https://github.com/k2-fsa/sherpa-ncnn">sherpa-ncnn</a>
|
|
for performing speech recognition using <a class="reference external" href="https://github.com/tencent/ncnn">ncnn</a> with exported models.
|
|
It has been tested on the following platforms:</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li><p>Linux</p></li>
|
|
<li><p>macOS</p></li>
|
|
<li><p>Windows</p></li>
|
|
<li><p><code class="docutils literal notranslate"><span class="pre">Android</span></code></p></li>
|
|
<li><p><code class="docutils literal notranslate"><span class="pre">iOS</span></code></p></li>
|
|
<li><p><code class="docutils literal notranslate"><span class="pre">Raspberry</span> <span class="pre">Pi</span></code></p></li>
|
|
<li><p><a class="reference external" href="https://wiki.sipeed.com/hardware/zh/">爱芯派</a> (<a class="reference external" href="https://wiki.sipeed.com/hardware/en/maixIII/ax-pi/axpi.html">MAIX-III AXera-Pi</a>).</p></li>
|
|
<li><p><a class="reference external" href="https://www.rock-chips.com/a/en/products/RV11_Series/2020/0427/1076.html">RV1126</a></p></li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<p><a class="reference external" href="https://github.com/k2-fsa/sherpa-ncnn">sherpa-ncnn</a> is self-contained and can be statically linked to produce
|
|
a binary containing everything needed. Please refer
|
|
to its documentation for details:</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li><p><a class="reference external" href="https://k2-fsa.github.io/sherpa/ncnn/index.html">https://k2-fsa.github.io/sherpa/ncnn/index.html</a></p></li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<div class="toctree-wrapper compound">
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="export-ncnn-zipformer.html">Export streaming Zipformer transducer models to ncnn</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-zipformer.html#download-the-pre-trained-model">1. Download the pre-trained model</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-zipformer.html#install-ncnn-and-pnnx">2. Install ncnn and pnnx</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-zipformer.html#export-the-model-via-torch-jit-trace">3. Export the model via torch.jit.trace()</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-zipformer.html#export-torchscript-model-via-pnnx">4. Export torchscript model via pnnx</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-zipformer.html#test-the-exported-models-in-icefall">5. Test the exported models in icefall</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-zipformer.html#modify-the-exported-encoder-for-sherpa-ncnn">6. Modify the exported encoder for sherpa-ncnn</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="export-ncnn-conv-emformer.html">Export ConvEmformer transducer models to ncnn</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#download-the-pre-trained-model">1. Download the pre-trained model</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#install-ncnn-and-pnnx">2. Install ncnn and pnnx</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#export-the-model-via-torch-jit-trace">3. Export the model via torch.jit.trace()</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#export-torchscript-model-via-pnnx">4. Export torchscript model via pnnx</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#test-the-exported-models-in-icefall">5. Test the exported models in icefall</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#modify-the-exported-encoder-for-sherpa-ncnn">6. Modify the exported encoder for sherpa-ncnn</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-conv-emformer.html#optional-int8-quantization-with-sherpa-ncnn">7. (Optional) int8 quantization with sherpa-ncnn</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="export-ncnn-lstm.html">Export LSTM transducer models to ncnn</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#download-the-pre-trained-model">1. Download the pre-trained model</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#install-ncnn-and-pnnx">2. Install ncnn and pnnx</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#export-the-model-via-torch-jit-trace">3. Export the model via torch.jit.trace()</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#export-torchscript-model-via-pnnx">4. Export torchscript model via pnnx</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#test-the-exported-models-in-icefall">5. Test the exported models in icefall</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#modify-the-exported-encoder-for-sherpa-ncnn">6. Modify the exported encoder for sherpa-ncnn</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="export-ncnn-lstm.html#optional-int8-quantization-with-sherpa-ncnn">7. (Optional) int8 quantization with sherpa-ncnn</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</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="export-ncnn-zipformer.html" class="btn btn-neutral float-right" title="Export streaming Zipformer transducer models 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> |