FunASRTranscriber
Transcribe audio files to text using FunASR, an open source speech recognition toolkit from Alibaba DAMO Academy. Use this component as a local alternative to Whisper when you need multilingual transcription, speaker diarization, or timestamp extraction without an API key.
Key Features
- Transcribes audio locally using FunASR models downloaded from ModelScope on first use.
- Supports 50+ languages with models such as
iic/SenseVoiceSmall,paraformer-zh, andparaformer-en. - Optional voice activity detection, punctuation restoration, and speaker diarization.
- Accepts audio files as file paths,
Pathobjects, orByteStreamobjects. - Returns transcriptions as Haystack
Documentobjects with optional timestamp and speaker metadata. - Configurable device support (CPU or GPU) for inference.
Configuration
Add Workspace-Level Integration
- Click your profile icon and choose Settings.
- Go to Workspace>Integrations.
- Find the provider you want to connect and click Connect next to them.
- Enter the API key and any other required details.
- Click Connect. You can use this integration in pipelines and indexes in the current workspace.
Add Organization-Level Integration
- Click your profile icon and choose Settings.
- Go to Organization>Integrations.
- Find the provider you want to connect and click Connect next to them.
- Enter the API key and any other required details.
- Click Connect. You can use this integration in pipelines and indexes in all workspaces in the current organization.
- Drag the
FunASRTranscribercomponent onto the canvas from the Component Library. - Click on the component to open the configuration panel.
- On the General tab:
- Set the
modelto the FunASR model you want to use. The defaultiic/SenseVoiceSmallsupports 50+ languages and is faster than Whisper. - Optionally enable
vad_model,punc_model, andspk_modelfor segmentation, punctuation, and speaker diarization.
- Set the
- Go to the Advanced tab to configure
device,batch_size_s,store_full_path, andgeneration_kwargs.
Models are cached in ~/.cache/modelscope after the first download. GPU inference requires a CUDA-capable device.
Connections
FunASRTranscriber receives a list of audio file sources. It outputs a list of Document objects containing the transcription text. Connect its documents output to a splitter, embedder, or other pipeline components.
Source Code
To check this component's source code, open transcriber.py in the Haystack Core Integrations repository.
Usage Examples
Basic Configuration
FunASRTranscriber:
type: haystack_integrations.components.audio.funasr.transcriber.FunASRTranscriber
init_parameters:
model: iic/SenseVoiceSmall
generation_kwargs:
language: auto
Using the Component in a Pipeline
# haystack-pipeline
components:
FunASRTranscriber:
type: haystack_integrations.components.audio.funasr.transcriber.FunASRTranscriber
init_parameters:
model: iic/SenseVoiceSmall
vad_model: fsmn-vad
punc_model: ct-punc
document_splitter:
type: haystack.components.preprocessors.document_splitter.DocumentSplitter
init_parameters:
split_by: word
split_length: 250
split_overlap: 30
connections:
- sender: FunASRTranscriber.documents
receiver: document_splitter.documents
max_runs_per_component: 100
metadata: {}
Parameters
Inputs
| Parameter | Type | Description |
|---|---|---|
sources | List[Union[str, Path, ByteStream]] | A list of audio file paths, Path objects, or ByteStream objects to transcribe. Supported formats include WAV, MP3, FLAC, OGG, M4A, AAC, and MP4. |
meta | Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] | Metadata to attach to the produced documents. Pass a single dict to apply the same metadata to all documents, or a list aligned with sources. |
Outputs
| Parameter | Type | Description |
|---|---|---|
documents | List[Document] | One document per source whose content holds the full transcript text. Metadata may include file_path, timestamps, and speakers. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
model | str | iic/SenseVoiceSmall | FunASR model name or local path. Alternatives include paraformer-zh (Chinese) and paraformer-en (English). |
vad_model | Optional[str] | fsmn-vad | Voice activity detection model used to split long audio into segments. Set to None to process the audio as a single stream. |
punc_model | Optional[str] | ct-punc | Punctuation restoration model. Set to None to disable punctuation. |
spk_model | Optional[str] | None | Speaker diarization model (for example, cam++). When set, a speakers key is included in document metadata. |
device | Optional[ComponentDevice] | None | The device to run inference on. If not set, automatically detected. |
batch_size_s | int | 300 | Batch size in seconds for VAD-segmented audio. Larger values improve throughput at the cost of memory. |
store_full_path | bool | False | If True, store the full audio file path in document metadata. If False, store only the file name. |
generation_kwargs | Optional[Dict[str, Any]] | None | Extra keyword arguments forwarded to AutoModel.generate(). Use for model-specific options such as use_itn, merge_vad, language, or hotword. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
sources | List[Union[str, Path, ByteStream]] | A list of audio file paths or streams to transcribe. | |
meta | Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] | None | Metadata to attach to the produced documents. |
Related Information
Was this page helpful?