mirror of
https://github.com/modelscope/FunASR.git
synced 2026-10-12 02:19:18 +00:00
301 lines
25 KiB
HTML
301 lines
25 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta content="width=device-width, initial-scale=1" name="viewport"/>
|
|
<title>Custom model registration - FunASR</title>
|
|
<meta content="Custom model registration" name="description"/>
|
|
<meta content="#ffffff" name="theme-color"/>
|
|
<link href="https://www.funasr.com/en/docs/model-registration.html" rel="canonical"/>
|
|
<link href="https://www.funasr.com/docs/model-registration.html" hreflang="zh-CN" rel="alternate"/>
|
|
<link href="https://www.funasr.com/en/docs/model-registration.html" hreflang="en" rel="alternate"/>
|
|
<meta content="website" property="og:type"/>
|
|
<meta content="Custom model registration - FunASR" property="og:title"/>
|
|
<meta content="Custom model registration" property="og:description"/>
|
|
<meta content="https://www.funasr.com/en/docs/model-registration.html" property="og:url"/>
|
|
<link href="assets/css/site.7be954c8e106.css" rel="stylesheet"/>
|
|
<link href="assets/css/experience.34d6e632686e.css" rel="stylesheet"/>
|
|
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "SoftwareApplication", "applicationCategory": "DeveloperApplication", "codeRepository": "https://github.com/modelscope/FunASR", "dateModified": "2026-09-01", "license": "https://github.com/modelscope/FunASR/blob/main/LICENSE", "name": "FunASR", "operatingSystem": "Linux, macOS, Windows", "url": "https://www.funasr.com/en/docs/model-registration.html"}</script></head>
|
|
<body data-copy-icon="assets/lucide/copy.ea80e566c7a1.svg" data-language="en" data-route="/en/docs/model-registration.html">
|
|
<a class="skip-link" href="#main">Skip to main content</a>
|
|
<header class="site-header">
|
|
<a aria-label="FunASR home" class="brand" href="https://www.funasr.com/en/">
|
|
<span aria-hidden="true" class="brand-mark">F</span>
|
|
<span>FunASR</span>
|
|
</a>
|
|
<button aria-controls="primary-navigation" aria-expanded="false" class="icon-button menu-button" data-menu-toggle="" title="Open navigation" type="button">
|
|
<img alt="" src="assets/lucide/menu.90a31b3ab1cf.svg"/>
|
|
</button>
|
|
<nav aria-label="Primary navigation" class="primary-navigation" data-primary-nav="" id="primary-navigation">
|
|
<a href="https://www.funasr.com/en/">Product</a>
|
|
<a href="https://www.funasr.com/en/deploy/">Deploy</a>
|
|
<a href="https://www.funasr.com/en/models.html">Models</a>
|
|
<a href="https://www.funasr.com/en/benchmarks.html">Benchmarks</a>
|
|
<a href="https://www.funasr.com/en/ecosystem.html">Ecosystem</a>
|
|
<a href="https://www.funasr.com/en/blog/">Blog</a>
|
|
<a href="https://www.funasr.com/en/docs/">Docs</a>
|
|
<a href="https://www.funasr.com/en/donors.html">Donors</a>
|
|
</nav>
|
|
<div class="header-actions">
|
|
<a class="icon-link" href="https://www.funasr.com/docs/model-registration.html" title="简体中文">
|
|
<img alt="" src="assets/lucide/languages.ae9048feb2c7.svg"/>
|
|
<span>中文</span>
|
|
</a>
|
|
<a aria-label="GitHub" class="icon-button" href="https://www.funasr.com/go/github" title="GitHub">
|
|
<img alt="" src="assets/lucide/github.793554449a30.svg"/>
|
|
</a>
|
|
</div>
|
|
</header>
|
|
<main id="main">
|
|
<div class="docs-layout">
|
|
<aside class="docs-sidebar">
|
|
<a class="docs-home" href="https://www.funasr.com/en/docs/">Documentation</a>
|
|
<details class="docs-navigation" open="">
|
|
<summary class="docs-navigation-toggle">Browse topics</summary>
|
|
<details open="">
|
|
<summary>Get started</summary>
|
|
<nav aria-label="Get started">
|
|
<a href="https://www.funasr.com/en/docs/native-transformers.html">Transformers quickstart</a>
|
|
<a href="https://www.funasr.com/en/docs/installation.html">Installation & environment checks</a>
|
|
<a href="https://www.funasr.com/en/docs/quickstart.html">Your first transcription</a>
|
|
<a href="https://www.funasr.com/en/docs/python-api.html">Python SDK: AutoModel</a>
|
|
<a href="https://www.funasr.com/en/docs/model-selection.html">Choose your first model</a>
|
|
<a href="https://www.funasr.com/en/docs/command-line.html">Command-line transcription</a>
|
|
<a href="https://www.funasr.com/en/docs/migration.html">Migrate from Whisper & cloud APIs</a>
|
|
</nav>
|
|
</details>
|
|
<details open="">
|
|
<summary>Models & capabilities</summary>
|
|
<nav aria-label="Models & capabilities">
|
|
<a href="https://www.funasr.com/en/docs/moss-transcribe-diarize.html">MOSS transcription & diarization</a>
|
|
<a href="https://www.funasr.com/en/docs/model-zoo.html">Model Zoo</a>
|
|
<a href="https://www.funasr.com/en/docs/streaming-vad.html">Streaming voice activity detection</a>
|
|
<a href="https://www.funasr.com/en/docs/keyword-spotting.html">Keyword spotting</a>
|
|
<a href="https://www.funasr.com/en/docs/speaker-emotion.html">Speakers and emotion tags</a>
|
|
</nav>
|
|
</details>
|
|
<details open="">
|
|
<summary>Train & extend</summary>
|
|
<nav aria-label="Train & extend">
|
|
<a href="https://www.funasr.com/en/docs/training.html">Fine-tuning & evaluation</a>
|
|
<a aria-current="page" href="https://www.funasr.com/en/docs/model-registration.html">Custom model registration</a>
|
|
</nav>
|
|
</details>
|
|
<details open="">
|
|
<summary>Deploy & integrate</summary>
|
|
<nav aria-label="Deploy & integrate">
|
|
<a href="https://www.funasr.com/en/docs/docker.html">Containers & image selection</a>
|
|
<a href="https://www.funasr.com/en/docs/runtime-guide.html">Serving entry points</a>
|
|
<a href="https://www.funasr.com/en/docs/http-server.html">Python HTTP service</a>
|
|
<a href="https://www.funasr.com/en/docs/kubernetes.html">Kubernetes deployment</a>
|
|
<a href="https://www.funasr.com/en/docs/deployment-matrix.html">Runtime & deployment matrix</a>
|
|
<a href="https://www.funasr.com/en/docs/vllm.html">vLLM split-engine inference</a>
|
|
<a href="https://www.funasr.com/en/docs/official-native-vllm.html">Official native vLLM functional validation (2026-09-07)</a>
|
|
<a href="https://www.funasr.com/en/docs/native-vllm.html">Historical community native vLLM record (2026-08-13)</a>
|
|
</nav>
|
|
</details>
|
|
<details open="">
|
|
<summary>Evaluate & operate</summary>
|
|
<nav aria-label="Evaluate & operate">
|
|
<a href="https://www.funasr.com/en/docs/troubleshooting.html">Troubleshooting</a>
|
|
<a href="https://www.funasr.com/en/docs/security.html">Service security boundaries</a>
|
|
<a href="https://www.funasr.com/en/docs/benchmark-method.html">Reproducible performance tests</a>
|
|
<a href="https://www.funasr.com/en/docs/historical-asr-benchmark.html">Historical ASR benchmark</a>
|
|
<a href="https://www.funasr.com/en/docs/realtime-benchmark.html">Realtime WebSocket benchmarking</a>
|
|
</nav>
|
|
</details>
|
|
<details open="">
|
|
<summary>Applications & ecosystem</summary>
|
|
<nav aria-label="Applications & ecosystem">
|
|
<a href="https://www.funasr.com/en/docs/agent-integration.html">Agent integration</a>
|
|
<a href="https://www.funasr.com/en/docs/use-cases.html">Use cases & examples</a>
|
|
<a href="https://www.funasr.com/en/docs/community.html">Community integrations</a>
|
|
<a href="https://www.funasr.com/en/docs/repositories.html">Repositories & contribution paths</a>
|
|
<a href="https://www.funasr.com/en/docs/javascript.html">JavaScript clients</a>
|
|
<a href="https://www.funasr.com/en/docs/gradio.html">Gradio browser client</a>
|
|
<a href="https://www.funasr.com/en/docs/workflows.html">Workflow integrations</a>
|
|
</nav>
|
|
</details>
|
|
<details open="">
|
|
<summary>Protocols & reference</summary>
|
|
<nav aria-label="Protocols & reference">
|
|
<a href="https://www.funasr.com/en/docs/service-api.html">HTTP API contract</a>
|
|
<a href="https://www.funasr.com/en/docs/websocket-protocol.html">C++ WebSocket protocol</a>
|
|
<a href="https://www.funasr.com/en/docs/onnx-output.html">ONNX binary output contract</a>
|
|
</nav>
|
|
</details>
|
|
<a href="https://www.funasr.com/en/deploy/">Deployment guides →</a>
|
|
</details>
|
|
</aside>
|
|
<div class="docs-body">
|
|
<nav aria-label="Breadcrumbs" class="breadcrumbs"><a href="https://www.funasr.com/en/">FunASR</a><span>/</span><a href="https://www.funasr.com/en/docs/">Docs</a><span>/</span><span>Custom model registration</span></nav>
|
|
<header class="docs-title"><h1>Custom model registration</h1><a class="source-link" data-source-link="" href="https://github.com/modelscope/FunASR/blob/main/docs/model_registration.md">View / edit source ↗</a></header>
|
|
<article class="docs-article"><div class="source-title-anchor" id="model-registration"></div>
|
|
<p><a href="https://www.funasr.com/docs/model-registration.html">简体中文</a> | <a href="https://www.funasr.com/en/docs/quickstart.html">Documentation</a> | <a href="https://www.funasr.com/en/docs/training.html">Training</a> | <a href="https://github.com/modelscope/FunASR/blob/main/docs/tutorial/Tables.md">Historical registry tutorial</a></p>
|
|
<p>Registration connects a Python implementation to a configuration name. It does not download weights, make an arbitrary Transformers model compatible, provide training/export support, or certify model quality. This guide describes the checked-in <a href="https://github.com/modelscope/FunASR/blob/main/funasr/register.py">registry</a>, <a href="https://github.com/modelscope/FunASR/blob/main/funasr/auto/auto_model.py">AutoModel</a>, <a href="https://github.com/modelscope/FunASR/blob/main/funasr/download/download_model_from_hub.py">hub loader</a> and <a href="https://github.com/modelscope/FunASR/blob/main/funasr/utils/dynamic_import.py">dynamic importer</a>.</p>
|
|
<span data-legacy-doc-anchor="names-and-import-order" id="architecture"></span><span data-legacy-doc-anchor="names-and-import-order" id="add-component"></span><h2 id="names-and-import-order">Names and Import Order</h2>
|
|
<p>Use <code>@tables.register("model_classes", "YourUniqueModelName")</code> on a class imported before construction. <code>tables</code> comes from <code>funasr.register</code>. The second argument is the exact, case-sensitive registry key; omitting it uses the Python class name. The decorator returns the original class and records its source location with <code>inspect</code>, so define examples in importable <code>.py</code> files, not only a REPL or dynamically generated class.</p>
|
|
<p>Keys live in process-global dictionaries. An existing key is overwritten, with a debug log rather than an error; imports and their order therefore matter. Use an organization/project-specific name and a collision guard. Avoid names such as <code>SenseVoiceSmall</code>, <code>Paraformer</code> or <code>FunASRNano</code> for unrelated custom models. <code>tables.print("model")</code> displays registration metadata; <code>tables.model_classes[name]</code> gives the active implementation.</p>
|
|
<p>Other tables include <code>encoder_classes</code>, <code>decoder_classes</code>, <code>frontend_classes</code>, <code>tokenizer_classes</code>, <code>dataset_classes</code>, <code>index_ds_classes</code> and <code>batch_sampler_classes</code>. Each consumer has its own contract: registering an encoder does not make it a complete <code>AutoModel</code> model. The registry also permits new table names, so a typo can create an unused table instead of failing.</p>
|
|
<span data-legacy-doc-anchor="minimal-local-contract-example" id="setup"></span><span data-legacy-doc-anchor="minimal-local-contract-example" id="add-model"></span><h2 id="minimal-local-contract-example">Minimal Local Contract Example</h2>
|
|
<p>Put the following example in an importable <code>custom_model_demo.py</code> in a scratch directory, then run <code>python custom_model_demo.py</code> with this checkout installed. It intentionally returns input text, not speech recognition. It does not need weights, audio, a hub download, or GPU. The parameter is present because this <code>AutoModel.inference</code> inspects <code>next(model.parameters()).device</code>; a parameterless toy fails that path.</p>
|
|
<pre id="code-0"><code class="language-python">import torch
|
|
from funasr import AutoModel
|
|
from funasr.register import tables
|
|
|
|
MODEL_NAME = "DocsEchoModelV1"
|
|
if MODEL_NAME in tables.model_classes:
|
|
raise RuntimeError(f"Registry collision: {MODEL_NAME}")
|
|
|
|
|
|
@tables.register("model_classes", MODEL_NAME)
|
|
class DocsEchoModel(torch.nn.Module):
|
|
def __init__(self, **kwargs):
|
|
super().__init__()
|
|
self.anchor = torch.nn.Parameter(torch.zeros(1), requires_grad=False)
|
|
|
|
def inference(
|
|
self, data_in, data_lengths=None, key=None,
|
|
tokenizer=None, frontend=None, **kwargs,
|
|
):
|
|
results = [
|
|
{"key": sample_key, "text": str(value)}
|
|
for sample_key, value in zip(key, data_in)
|
|
]
|
|
return results, {}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
model = AutoModel(
|
|
model=MODEL_NAME,
|
|
model_conf={},
|
|
device="cpu",
|
|
disable_update=True,
|
|
disable_pbar=True,
|
|
)
|
|
result = model.generate(input=["hello", "world"], data_type="text")
|
|
assert [row["text"] for row in result] == ["hello", "world"]
|
|
assert all(isinstance(row["key"], str) for row in result)
|
|
print([row["text"] for row in result])
|
|
</code></pre>
|
|
<p>Expected final printed list: <code>['hello', 'world']</code>. This is a wiring check only. The focused documentation test executes this block in a temporary file against the checked-out implementation; it does not validate a speech model.</p>
|
|
<p>The presence of <code>model_conf={}</code> is intentional: <code>AutoModel.build_model</code> skips hub/config resolution when that key is supplied. Thus <code>model</code> is the already-registered class key here, not a model directory or hub ID. Import the custom module yourself first; adding <code>remote_code</code> to this direct path does not cause it to be imported. Resolved kwargs are merged over <code>model_conf</code> and passed to the constructor, including built tokenizer/frontend objects, device and vocabulary/input sizes. Accept appropriate named arguments plus <code>**kwargs</code>, as the real models do.</p>
|
|
<span data-legacy-doc-anchor="inference-and-training-contracts" id="understand"></span><h2 id="inference-and-training-contracts">Inference and Training Contracts</h2>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Interface</th>
|
|
<th>Contract in this checkout</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Model object</td>
|
|
<td>Normally <code>torch.nn.Module</code>; must support <code>.to(...)</code>, <code>.eval()</code> and <code>.parameters()</code>. Constructor configuration is model-specific.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>inference</code> inputs</td>
|
|
<td>Without VAD, AutoModel batches input into <code>data_in</code> and <code>key</code> lists and calls <code>model.inference(**batch, **kwargs)</code> under <code>torch.no_grad()</code>. With <code>data_type="fbank"</code> and one item, it passes the feature object directly and supplies <code>data_lengths=input_len</code>. Tokenizer/frontend are resolved objects or <code>None</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Model-level return</td>
|
|
<td>Return a two-item tuple <code>(results, meta_data)</code>: <code>results</code> is <code>list[dict]</code>, <code>meta_data</code> is a dictionary. For ASR use string <code>key</code> and <code>text</code> fields, preserving the input order/keys. Returning a bare list of result dictionaries is wrong: AutoModel treats its first item as the entire batch result.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Metadata</td>
|
|
<td>Optional <code>load_data</code>, <code>extract_feat</code>, <code>batch_data_time</code>. For audio, <code>batch_data_time</code> is a positive duration in seconds, not milliseconds; zero causes division by zero in timing code. Omitting it gives the internal <code>-1</code> sentinel, as in the non-audio toy, not a meaningful speed measurement.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Public return</td>
|
|
<td><code>AutoModel.generate(...)</code> returns the flattened result list. Additional fields such as timestamps are model-specific; registration does not promise them. VAD, punctuation, speaker and streaming integrations need additional compatible behavior and independent tests.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Training</td>
|
|
<td>Implement differentiable <code>forward</code> matching the dataset collator's named tensor fields. <a href="https://github.com/modelscope/FunASR/blob/main/funasr/train_utils/trainer_ds.py">Trainer</a> unpacks <code>(loss, stats, weight)</code>; <a href="https://github.com/modelscope/FunASR/blob/main/funasr/models/sense_voice/model.py">SenseVoice</a> and <a href="https://github.com/modelscope/FunASR/blob/main/funasr/models/fun_asr_nano/model.py">Nano</a> use <code>force_gatherable</code>. The toy deliberately has no training forward.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Export</td>
|
|
<td><a href="https://github.com/modelscope/FunASR/blob/main/funasr/utils/export_utils.py">Export utility</a> calls the model's <code>export</code> and then model-specific methods such as <code>export_dummy_inputs</code>, input/output names and dynamic axes. Registration alone does not implement these.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>A custom model must itself implement audio loading, feature preparation, tokenization/decoding and batching where needed. Copy the contract from a close real model, not its capabilities without implementation. For training, also implement/configure the appropriate dataset and loss; see <a href="https://www.funasr.com/en/docs/training.html">training</a>.</p>
|
|
<span data-legacy-doc-anchor="loading-reviewed-custom-code-and-weights" id="standalone"></span><h2 id="loading-reviewed-custom-code-and-weights">Loading Reviewed Custom Code and Weights</h2>
|
|
<p>There are two distinct routes:</p>
|
|
<ol>
|
|
<li><strong>Direct registration:</strong> import your module; pass its key and <code>model_conf</code> as in the toy. Provide compatible tokenizer/frontend/configuration and an existing <code>init_param</code> if weights are needed. No hub code import is performed on this path.</li>
|
|
<li><strong>Model-directory resolution:</strong> pass a reviewed local directory or hub ID without <code>model_conf</code>. The loader reads <code>configuration.json</code> file metadata or <code>config.yaml</code>, resolves the model key/assets and loads weights. A simple local <code>config.yaml</code> directory normally also needs <code>model.pt</code> plus all referenced tokenizer/frontend assets. Arbitrary HF weight folders are not automatically FunASR model directories.</li>
|
|
</ol>
|
|
<p>For the second route, this is the ModelScope-path interface, not a self-contained runnable example. <code>models/custom-asr</code> must already contain the compatible reviewed configuration and weights, and <code>custom_asr_model.py</code> must register the exact configuration key:</p>
|
|
<pre id="code-1"><code class="language-python">from funasr import AutoModel
|
|
|
|
model = AutoModel(
|
|
model="./models/custom-asr",
|
|
hub="ms",
|
|
trust_remote_code=True,
|
|
remote_code="./custom_asr_model.py",
|
|
device="cpu",
|
|
disable_update=True,
|
|
)
|
|
print(model.generate(input="data/audio/heldout.wav"))
|
|
</code></pre>
|
|
<p>The current <code>download_from_ms</code> imports <code>remote_code</code> when <code>trust_remote_code=True</code>, defaulting to module name <code>model</code> if omitted. The importer supports module/file paths (and URL download), appends the directory to <code>sys.path</code> and imports by basename. A relative path is relative to the working directory, not automatically to the weights directory. Basename collisions and Python's import cache can select an already-loaded module; use distinct module names and verify the active class. Import exceptions are printed rather than re-raised by this helper, so inspect errors and registry state.</p>
|
|
<p><strong>The <code>hub="hf"</code> path differs:</strong> in this checkout <code>download_from_hf</code> can install model requirements under the trust flag but does not call <code>import_module_from_path</code>. Do not assume <code>remote_code</code> is executed there. Import your reviewed custom module explicitly before constructing with <code>hub="hf"</code>, or use the direct-registration route with complete configuration. The local <code>config.yaml</code> fallback also handles <code>init_param</code> differently between hubs: ModelScope retains an existing explicit path; Hugging Face assigns the directory's <code>model.pt</code>. Check the resolved path rather than assuming a selected checkpoint override survived.</p>
|
|
<span data-legacy-doc-anchor="real-examples-and-boundaries" id="contribute"></span><h2 id="real-examples-and-boundaries">Real Examples and Boundaries</h2>
|
|
<ul>
|
|
<li><a href="https://github.com/modelscope/FunASR/blob/main/funasr/models/sense_voice/model.py">SenseVoiceSmall implementation</a> demonstrates a registered model with training, inference and export integration. Retain its model-specific configuration and tokenizer assumptions.</li>
|
|
<li><a href="https://github.com/modelscope/FunASR/blob/main/examples/industrial_data_pretraining/fun_asr_nano/demo1.py">Nano demo1.py</a> shows <code>trust_remote_code=True</code>, <code>remote_code="./model.py"</code>, <code>hub="ms"</code>; it assumes the recipe directory. Its <a href="https://github.com/modelscope/FunASR/blob/main/examples/industrial_data_pretraining/fun_asr_nano/model.py">local implementation</a> registers <code>FunASRNano</code> and imports sibling <code>ctc</code> and <code>tools</code> modules. That can overwrite the <a href="https://github.com/modelscope/FunASR/blob/main/funasr/models/fun_asr_nano/model.py">built-in implementation</a>; the two are not interchangeable for every feature, including built-in LoRA. Audit the active class and checkpoint keys.</li>
|
|
<li><a href="https://github.com/modelscope/FunASR/blob/main/funasr/models/moss_transcribe_diarize/model.py">MOSS adapter</a> integrates the third-party OpenMOSS model, and explicitly rejects training in <code>forward</code>. It is not evidence that a registered model supports fine-tuning or export.</li>
|
|
<li>The <a href="https://github.com/modelscope/FunASR/blob/main/docs/tutorial/Tables.md">original registration tutorial</a> and <a href="https://www.funasr.com/en/docs/quickstart.html">general tutorial</a> remain useful historical references; use the current source behavior above when their examples differ.</li>
|
|
</ul>
|
|
<span data-legacy-doc-anchor="safety-and-verification" id="testing"></span><span data-legacy-doc-anchor="safety-and-verification" id="pitfalls"></span><h2 id="safety-and-verification">Safety and Verification</h2>
|
|
<p><code>trust_remote_code=True</code> permits Python execution; the hub loaders can also install a model directory's <code>requirements.txt</code>. A local directory is not inherently trustworthy. Review source, dependencies and weight serialization, use isolated environments, and do not load untrusted pickled checkpoints. Never interpolate untrusted URLs, module names or configs into this workflow. Keep a reviewed local snapshot with hashes when remote revision handling cannot be relied on; <code>model_revision</code> is not a universal pin across all loader paths here.</p>
|
|
<p>Check the active registry key/class/source before loading. Confirm exact model/config/tokenizer compatibility and inspect missing/unexpected weights: <code>ignore_init_mismatch</code> defaults to true in AutoModel, and a nonexistent direct <code>init_param</code> prints an error rather than guaranteeing construction fails. Validate checkpoint existence yourself. Test one item, multiple items, error handling and the intended pipeline before training/export/deployment. FunASR software's MIT license does not replace model or upstream component licenses.</p>
|
|
<p>Focused syntax, repository-link and no-download toy-contract checks:</p>
|
|
<pre id="code-2"><code class="language-bash">python -m pytest -q tests/test_training_docs_contract.py
|
|
</code></pre>
|
|
<p>These checks do not certify arbitrary custom code, actual ASR quality, GPU training, real-checkpoint restoration or export compatibility.</p></article>
|
|
<nav aria-label="Adjacent documents" class="docs-next">
|
|
<a href="https://www.funasr.com/en/docs/training.html">← Fine-tuning & evaluation</a><a href="https://www.funasr.com/en/docs/docker.html">Containers & image selection →</a> </nav>
|
|
</div>
|
|
<aside class="docs-toc"><strong>On this page</strong><div class="toc">
|
|
<ul>
|
|
<li><a href="#model-registration">Model Registration</a><ul>
|
|
<li><a href="#names-and-import-order">Names and Import Order</a></li>
|
|
<li><a href="#minimal-local-contract-example">Minimal Local Contract Example</a></li>
|
|
<li><a href="#inference-and-training-contracts">Inference and Training Contracts</a></li>
|
|
<li><a href="#loading-reviewed-custom-code-and-weights">Loading Reviewed Custom Code and Weights</a></li>
|
|
<li><a href="#real-examples-and-boundaries">Real Examples and Boundaries</a></li>
|
|
<li><a href="#safety-and-verification">Safety and Verification</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</aside></div>
|
|
</main>
|
|
<footer class="site-footer">
|
|
<div>
|
|
<strong>FunASR</strong>
|
|
<p>Open speech infrastructure for production deployment.</p>
|
|
</div>
|
|
<nav aria-label="Official repositories" class="footer-repositories" data-footer-repositories="">
|
|
<strong>Official repositories</strong>
|
|
<div class="footer-links">
|
|
<a href="https://www.funasr.com/go/fun-asr">Fun-ASR</a>
|
|
<a href="https://www.funasr.com/go/sensevoice">SenseVoice</a>
|
|
<a href="https://www.funasr.com/go/funclip">FunClip</a>
|
|
</div>
|
|
</nav>
|
|
<div class="footer-links">
|
|
<a href="https://www.funasr.com/en/deploy/">Deploy</a>
|
|
<a href="https://www.funasr.com/en/docs/">Docs</a>
|
|
<a href="https://www.funasr.com/go/releases">Releases</a>
|
|
<a href="https://www.funasr.com/en/donors.html">Donors</a>
|
|
</div>
|
|
</footer>
|
|
<script defer="" src="assets/js/site.d446f5fbcfe2.js"></script>
|
|
<script defer="" src="assets/js/experience.3f688a12942a.js"></script>
|
|
</body>
|
|
</html>
|