From a0bd3a13bce29b11de98f148aaef164bcd0755c8 Mon Sep 17 00:00:00 2001 From: LauraGPT Date: Wed, 16 Sep 2026 02:28:16 +0000 Subject: [PATCH] deploy: 4d8e08748c9d7cc10f3e3a01f5f4b927a8948699 --- api.html | 61 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/api.html b/api.html index b66bf91b5..2181d3b6c 100644 --- a/api.html +++ b/api.html @@ -1002,9 +1002,12 @@ Falls back to CPU if specified device is unavailable. vad_model (str, optional): VAD model for long audio segmentation. Enables processing of any-length audio. - vad_kwargs (dict, optional): VAD config, e.g. {"max_single_segment_time": 60000}. + vad_kwargs (dict, optional): VAD config, e.g. {"device": "cpu"}. + Explicit device overrides the ASR device; otherwise inherits its resolved device. punc_model (str, optional): Punctuation restoration model. Not needed for Fun-ASR-Nano/SenseVoice/Qwen3-ASR (they output punctuation natively). + punc_kwargs (dict, optional): Punctuation config; device follows the same rules as vad_kwargs. + spk_kwargs (dict, optional): Speaker config; device follows the same rules as vad_kwargs. spk_model (str, optional): Speaker model for diarization ("cam++" or full model ID). Requires vad_model. For Qwen3-ASR, also requires forced_aligner. spk_mode (str, optional): Speaker diarization mode. "punc_segment" (default) or "vad_segment". @@ -1018,9 +1021,6 @@ >>> model = AutoModel(model="paraformer-zh", vad_model="fsmn-vad", punc_model="ct-punc") >>> model = AutoModel(model="FunAudioLLM/Fun-ASR-Nano-2512", trust_remote_code=True, ... remote_code="./model.py", vad_model="fsmn-vad", spk_model="cam++", hub="hf") - """ - if "vda_model" in kwargs: - raise TypeError( View full source on GitHub →

Constructor

L420

Initialize AutoModel with ASR model and optional sub-models.

Args:

Methods

.build_model(**kwargs) L522

Download model from hub, build all components, and load pretrained weights.

+

Methods

.build_model(**kwargs) L529

Download model from hub, build all components, and load pretrained weights.

This method handles the full model construction pipeline:

1. Download model files from ModelScope/HuggingFace (if not local)

2. Parse config.yaml to determine model class, tokenizer, frontend

@@ -1090,7 +1093,7 @@ kwargs.setdefault("model_conf", {}) kwargs.setdefault("model_path", kwargs["model"]) if "model_conf" not in kwargs: -View full source →
.generate(input, input_len=None, progress_callback=None, **cfg) L695

Run speech recognition on input audio.

+View full source →
.generate(input, input_len=None, progress_callback=None, **cfg) L702

Run speech recognition on input audio.

This is the primary user-facing method. It automatically routes to:

  • inference() if no vad_model is configured (single utterance)
  • @@ -1107,6 +1110,8 @@
  • input_len (tensor, optional) — Length of each input sample.
  • progress_callback (callable, optional) — fn(current, total) called during processing.
  • **cfg — Runtime parameters:
  • +
  • device: Placement is selected at construction. Runtime device overrides
  • +
  • are ignored; create another AutoModel to use a different device.
  • cache (dict): State cache for streaming mode. Pass {} for first call.
  • hotword (str/list): Keywords to boost recognition accuracy.
  • postprocess_hotwords (str/list/dict): Text-level hotword correction after
  • @@ -1147,6 +1152,8 @@ input_len (tensor, optional): Length of each input sample. progress_callback (callable, optional): fn(current, total) called during processing. **cfg: Runtime parameters: + - device: Placement is selected at construction. Runtime device overrides + are ignored; create another AutoModel to use a different device. - cache (dict): State cache for streaming mode. Pass {} for first call. - hotword (str/list): Keywords to boost recognition accuracy. - postprocess_hotwords (str/list/dict): Text-level hotword correction after @@ -1158,9 +1165,7 @@ - language (str): Language hint ("auto", "zh", "en", "Chinese", etc.) - batch_size_s (int): Dynamic batch total duration in seconds. - is_final (bool): Last chunk flag for streaming mode. - - return_spk_res (bool): Return speaker diarization results. - - sentence_timestamp (bool): Return sentence-level timestamps. -View full source →
.inference(input, input_len=None, model=None, kwargs=None, key=None, progress_callback=None, **cfg) L756

Run model inference on input data (internal method).

+View full source →
.inference(input, input_len=None, model=None, kwargs=None, key=None, progress_callback=None, **cfg) L764

Run model inference on input data (internal method).

Handles batching, timing, and progress reporting. Called by generate()

and inference_with_vad(). Typically not called directly by users.

Args:

@@ -1205,7 +1210,7 @@ if kwargs is None: self._reset_runtime_configs() kwargs = self.kwargs if kwargs is None else kwargs -View full source →
.inference_with_vad(input, input_len=None, **cfg) L858

Run ASR with VAD segmentation, punctuation, and optional speaker diarization.

+View full source →
.inference_with_vad(input, input_len=None, **cfg) L866

Run ASR with VAD segmentation, punctuation, and optional speaker diarization.

Pipeline:

1. VAD: Segment audio into speech regions

2. ASR: Recognize each segment (sorted by length for efficient batching)

@@ -1244,13 +1249,13 @@ cfg["return_time_stamps"] = True kwargs = self.kwargs # step.1: compute the vad model - deep_update(self.vad_kwargs, cfg) beg_vad = time.time() res = self.inference( input, input_len=input_len, model=self.vad_model, kwargs=self.vad_kwargs, **cfg ) end_vad = time.time() -View full source →
.export(input=None, **cfg) L1263

Export model to ONNX format.

+ +View full source →
.export(input=None, **cfg) L1273

Export model to ONNX format.

Creates a deep copy of the model to isolate ONNX operator monkey-patching,

then runs torch.onnx.export. The original model remains usable after export.

Args:

@@ -1295,8 +1300,8 @@ device = cfg.get("device", "cpu") -View full source →
-
method

AutoModel.build_model(**kwargs)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Download model from hub, build all components, and load pretrained weights.

+View full source →
+
method

AutoModel.build_model(**kwargs)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Download model from hub, build all components, and load pretrained weights.

This method handles the full model construction pipeline:

1. Download model files from ModelScope/HuggingFace (if not local)

2. Parse config.yaml to determine model class, tokenizer, frontend

@@ -1341,8 +1346,8 @@ kwargs.setdefault("model_conf", {}) kwargs.setdefault("model_path", kwargs["model"]) if "model_conf" not in kwargs: -View full source on GitHub →
-
method

AutoModel.generate(input, input_len=None, progress_callback=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Run speech recognition on input audio.

+View full source on GitHub →
+
method

AutoModel.generate(input, input_len=None, progress_callback=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Run speech recognition on input audio.

This is the primary user-facing method. It automatically routes to:

  • inference() if no vad_model is configured (single utterance)
  • @@ -1359,6 +1364,8 @@
  • input_len (tensor, optional) — Length of each input sample.
  • progress_callback (callable, optional) — fn(current, total) called during processing.
  • **cfg — Runtime parameters:
  • +
  • device: Placement is selected at construction. Runtime device overrides
  • +
  • are ignored; create another AutoModel to use a different device.
  • cache (dict): State cache for streaming mode. Pass {} for first call.
  • hotword (str/list): Keywords to boost recognition accuracy.
  • postprocess_hotwords (str/list/dict): Text-level hotword correction after
  • @@ -1399,6 +1406,8 @@ input_len (tensor, optional): Length of each input sample. progress_callback (callable, optional): fn(current, total) called during processing. **cfg: Runtime parameters: + - device: Placement is selected at construction. Runtime device overrides + are ignored; create another AutoModel to use a different device. - cache (dict): State cache for streaming mode. Pass {} for first call. - hotword (str/list): Keywords to boost recognition accuracy. - postprocess_hotwords (str/list/dict): Text-level hotword correction after @@ -1410,10 +1419,8 @@ - language (str): Language hint ("auto", "zh", "en", "Chinese", etc.) - batch_size_s (int): Dynamic batch total duration in seconds. - is_final (bool): Last chunk flag for streaming mode. - - return_spk_res (bool): Return speaker diarization results. - - sentence_timestamp (bool): Return sentence-level timestamps. -View full source on GitHub →
-
method

AutoModel.inference(input, input_len=None, model=None, kwargs=None, key=None, progress_callback=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Run model inference on input data (internal method).

+View full source on GitHub →
+
method

AutoModel.inference(input, input_len=None, model=None, kwargs=None, key=None, progress_callback=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Run model inference on input data (internal method).

Handles batching, timing, and progress reporting. Called by generate()

and inference_with_vad(). Typically not called directly by users.

Args:

@@ -1458,8 +1465,8 @@ if kwargs is None: self._reset_runtime_configs() kwargs = self.kwargs if kwargs is None else kwargs -View full source on GitHub →
-
method

AutoModel.inference_with_vad(input, input_len=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Run ASR with VAD segmentation, punctuation, and optional speaker diarization.

+View full source on GitHub →
+
method

AutoModel.inference_with_vad(input, input_len=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Run ASR with VAD segmentation, punctuation, and optional speaker diarization.

Pipeline:

1. VAD: Segment audio into speech regions

2. ASR: Recognize each segment (sorted by length for efficient batching)

@@ -1498,14 +1505,14 @@ cfg["return_time_stamps"] = True kwargs = self.kwargs # step.1: compute the vad model - deep_update(self.vad_kwargs, cfg) beg_vad = time.time() res = self.inference( input, input_len=input_len, model=self.vad_model, kwargs=self.vad_kwargs, **cfg ) end_vad = time.time() -View full source on GitHub →
-
method

AutoModel.export(input=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Export model to ONNX format.

+ +View full source on GitHub →
+
method

AutoModel.export(input=None, **cfg)

funasr.auto.auto_model.AutoModel · View on GitHub ↗

Export model to ONNX format.

Creates a deep copy of the model to isolate ONNX operator monkey-patching,

then runs torch.onnx.export. The original model remains usable after export.

Args:

@@ -1550,7 +1557,7 @@ device = cfg.get("device", "cpu") -View full source on GitHub →
+View full source on GitHub →
function

check_vllm_applicable(model_name: str) -> bool

funasr.auto.auto_model_vllm · View on GitHub ↗

Check if a model can use vLLM inference.

Args: