Xpersona
F

Funasr Asr

CLAWHUB · Unverified

本地中文语音识别,使用阿里达摩院 FunASR。触发场景:(1) 用户发送语音消息需转录,(2) 需要转录音频/视频文件,(3) 从网页下载视频并转录,(4) 中文语音转文字任务。支持小内存模式(~500MB)和大模型模式(~2GB),自动内存管理,任务队列防并行。 Skill: Funasr Asr Owner: ruitao Summary: 本地中文语音识别,使用阿里达摩院 FunASR。触发场景:(1) 用户发送语音消息需转录,(2) 需要转录音频/视频文件,(3) 从网页下载视频并转录,(4) 中文语音转文字任务。支持小内存模式(~500MB)和大模型模式(~2GB),自动内存管理,任务队列防并行。 Tags: latest:2.0.0 Version history: v2.0.0 | 2026-04-09T03:39:03.935Z | user v2.0.0: 内存优化版 - 单进程分段转录 + SenseVoiceSmall 默认模型 核心变更: - 单进程分段转录:模型只加载一次(~500MB),逐段处理 - 默认模型改为 SenseVoiceSmall(~500MB vs paraformer ~2GB) - 新增 --segment 参数控制分段时长 - 段间 gc.

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s1748mayp6nwdbqqgh16d5x62s83hntp:funasr-asr
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-ruitao-funasr-asr/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

50,304 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: funasr-asr
description: Local speech recognition using Alibaba DAMO Academy's FunASR. Triggers: (1) user sends voice message requiring transcription, (2) need to transcribe audio/video files, (3) download video from web and transcribe, (4) speech-to-text tasks. Default SenseVoiceSmall model (~500MB), single-process segmented transcription for memory efficiency. Multilingual: Chinese, English, Japanese, Korean, Cantonese.
---

# FunASR 本地语音识别

阿里达摩院开源 ASR,完全本地部署,内存优化版。

## 快速使用

### 命令行

```bash
# 默认 small 模式(SenseVoiceSmall, ~500MB)
python3 scripts/transcribe.py /path/to/audio.wav

# 大模型模式(Paraformer-Large, ~2GB,中文极高精度)
python3 scripts/transcribe.py /path/to/audio.wav --mode large

# 自定义分段时长(默认 600 秒 = 10 分钟)
python3 scripts/transcribe.py /path/to/audio.wav --segment 300

# JSON 输出
python3 scripts/transcribe.py /path/to/audio.wav --format json

# 转录视频文件
python3 scripts/video-transcribe.py --audio /path/to/video.mp4
```

### Node.js 调用

```javascript
const funasr = require('./index.js');

const text = await funasr.transcribe('/path/to/audio.wav', {
  mode: 'small',    // 'small' 或 'large'
  format: 'text'    // 'text' 或 'json'
});
```

## 核心优化(v2.0)

| 优化项 | 旧方案 | 新方案 |
|--------|--------|--------|
| 进程模型 | 每段新进程 | 单进程,模型加载一次 |
| 默认模型 | paraformer (~2GB) | SenseVoiceSmall (~500MB) |
| 内存峰值 | ~2GB × N 次 | ~500MB 常驻 |
| 段间释放 | 进程退出 | gc.collect() |
| 任务锁 | ✅ | ✅ 保留 |

## 模式对比

| 特性 | small (默认) | large |
|------|-------------|-------|
| 模型 | SenseVoiceSmall | Paraformer-Large |
| 内存 | ~500MB | ~2GB |
| 语言 | 中英日韩粤 | 中文 |
| 精度 | 高 | 极高 |
| 速度 | 快 (~0.1 RTF) | 较慢 (~0.3 RTF) |
| 适用场景 | 日常转录 | 专业中文场景 |

## 安装

```bash
# Python 依赖
pip install funasr onnxruntime psutil

# 视频处理(可选)
pip install yt-dlp
apt install ffmpeg

# 首次运行自动下载模型
# small: ~500MB | large: ~2GB
```

## 支持格式

- **音频**: WAV, MP3, FLAC, M4A(自动转 16kHz mono)
- **视频**: MP4, WebM, AVI, MOV

## 故障排查

| 问题 | 解决 |
|------|------|
| 模型下载失败 | `pip install modelscope && modelscope download --model iic/SenseVoiceSmall` |
| 内存不足 (OOM) | 用 `--mode small --segment 300` 减小分段 |
| 音频格式错误 | `ffmpeg -i input.mp3 -ar 16000 -ac 1 output.wav` |
| 转录有奇怪标记 | 脚本自动清理 `<|en|>` 等 SenseVoice 标记 |

## 许可证

MIT License

_meta.json

{
  "ownerId": "kn7fc56vvh7d4mpzx4ck68t395838s9p",
  "slug": "funasr-asr",
  "version": "2.0.0",
  "publishedAt": 1775705943935
}

references/installation.md

# FunASR 安装指南

## 系统要求

- Python 3.8+
- 内存: 至少 2GB 可用(小内存模式 500MB)
- 存储: 约 3GB(模型文件)

## 安装步骤

### 1. Python 依赖

```bash
pip install funasr onnxruntime psutil
```

### 2. 视频处理工具(可选)

```bash
# yt-dlp(推荐)
pip install yt-dlp

# ffmpeg
apt install ffmpeg  # Ubuntu/Debian
brew install ffmpeg # macOS
```

### 3. 首次运行

首次运行会自动下载模型:

```bash
python3 scripts/transcribe.py test.wav
```

模型下载位置:`~/.cache/modelscope/hub/`

## GPU 加速

如有 NVIDIA GPU:

```bash
pip uninstall onnxruntime
pip install onnxruntime-gpu
```

## 验证安装

```bash
python3 -c "from funasr import AutoModel; print('✅ FunASR 已安装')"
```

## 常见问题

### 模型下载慢

使用国内镜像:

```bash
export MODELSCOPE_CACHE=~/.cache/modelscope
pip install modelscope
modelscope download --model iic/SenseVoiceSmall
```

### 内存不足

使用小内存模式:

```bash
python3 scripts/transcribe.py audio.wav --mode small
```

### 权限问题

确保脚本有执行权限:

```bash
chmod +x scripts/*.py scripts/*.sh
```

references/memory-optimization.md

# 内存优化指南

## 小内存模式原理

SenseVoiceSmall 模型使用更小的参数量:
- 模型大小: ~500MB(vs Paraformer-Large ~2GB)
- 推理内存: ~500MB 峰值
- 自动卸载: 转录完成后释放

## 任务队列机制

防止多个任务同时加载模型导致 OOM:

```python
# transcribe.py 内置锁机制
LOCK_DIR = Path("/tmp/funasr_locks")

# 同一音频文件只能被一个进程处理
# 其他进程会等待或退出(--no-wait)
```

## 内存检查

转录前自动检查可用内存:

```bash
# 如果可用内存 < 模型需求,会报错
python3 scripts/transcribe.py audio.wav
# 输出: 💾 可用内存: 800 MB, 需要: 500 MB ✅
```

## 优化策略

### 1. 使用小内存模式

```bash
python3 scripts/transcribe.py audio.wav --mode small
```

### 2. 减少 batch_size_s

修改 transcribe.py:

```python
batch_size_s = 150  # 默认 300,减少可降低峰值内存
```

### 3. 分段处理长音频

```bash
# 使用 ffmpeg 分割
ffmpeg -i long.wav -f segment -segment_time 300 -c copy part%03d.wav

# 逐个转录
for f in part*.wav; do
  python3 scripts/transcribe.py "$f"
done
```

### 4. 关闭不需要的模型

VAD 和标点模型会占用额外内存。如果不需要:

```python
# 只用 ASR 模型
model = AutoModel(
    model="iic/SenseVoiceSmall",
    # vad_model=None,  # 跳过 VAD
    # punc_model=None, # 跳过标点
)
```

### 5. 使用 INT8 量化模型

```bash
# 使用量化版本
modelscope download --model iic/SenseVoiceSmall-INT8
```

## 内存监控

```bash
# 实时监控
watch -n 1 'free -h'

# 或在转录时显示详细信息
python3 scripts/transcribe.py audio.wav --verbose
```

## OOM 故障排查

### 症状

```
OSError: [Errno 12] Cannot allocate memory
```

### 解决方案

1. 检查可用内存: `free -h`
2. 使用小内存模式: `--mode small`
3. 关闭其他进程
4. 增加 swap 空间

```bash
# 临时增加 swap
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```

## 推荐配置

| 场景 | 最低内存 | 推荐内存 |
|------|---------|---------|
| 小内存模式 | 1GB | 2GB |
| 大模型模式 | 3GB | 4GB |
| 批量处理 | 4GB | 8GB |

references/model-comparison.md

# 模型对比

## 小内存模式 (small)

**模型**: SenseVoiceSmall

**特点**:
- 内存占用: ~500MB
- 速度: 快
- 自动卸载: ✅ 转录完成后自动释放内存
- 适用场景: 日常转录、低配置服务器、多任务环境

**使用**:

```bash
python3 scripts/transcribe.py audio.wav --mode small
```

---

## 大模型模式 (large)

**模型**: Paraformer-Large

**特点**:
- 内存占用: ~2GB
- 速度: 稍慢
- 自动卸载: ❌ 模型保持在内存中
- 适用场景: 专业转录、高精度需求、批量处理

**使用**:

```bash
python3 scripts/transcribe.py audio.wav --mode large
```

---

## 对比表

| 特性 | small | large |
|------|-------|-------|
| 模型名称 | SenseVoiceSmall | Paraformer-Large |
| 内存占用 | ~500MB | ~2GB |
| 识别精度 | 高(日常够用) | 极高 |
| 推理速度 | 快 | 稍慢 |
| 自动卸载 | ✅ | ❌ |
| 并行安全 | ✅ 任务队列 | ⚠️ 需手动控制 |
| 推荐场景 | 日常转录 | 专业场景 |

---

## 选择建议

**使用 small 模式**:
- 服务器内存 < 2GB
- 偶尔转录任务
- 多个并行任务

**使用 large 模式**:
- 专业场景需要最高精度
- 批量处理多个文件
- 服务器内存充足

---

## 模型文件位置

```
~/.cache/modelscope/hub/
├── iic___SenseVoiceSmall/
│   └── ... (~500MB)
└── iic___speech_paraformer-large_asr.../
    └── ... (~2GB)
```

## 手动下载

```bash
# 小模型
modelscope download --model iic/SenseVoiceSmall

# 大模型
modelscope download --model iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
```

Sponsored

Ads related to Funasr Asr and adjacent AI workflows.