Skip to content

源码与 Python 本地安装 ​

如果你需要自定义引擎算子、贡献开源代码,或在 Apple Silicon Mac 上原生运行,请参考本指南。


1. 前置依赖 ​

  • Python:3.10 或 3.11
  • FFmpeg:音频格式转换与重采样依赖(macOS 运行 brew install ffmpeg,Ubuntu 运行 apt install ffmpeg)
  • Git & Git LFS:用于下载源码及大模型权重

2. 克隆仓库与配置虚拟环境 ​

bash
# 1. 克隆代码仓库
git clone https://github.com/codeAndxv/OneASR.git
cd OneASR

# 2. 创建并激活 Python 虚拟环境
python3 -m venv .venv
source .venv/bin/activate

# 3. 安装依赖包
pip install --upgrade pip
pip install -r requirements.txt

3. 下载模型权重 ​

根据 config.yaml 中启用的引擎,将模型权重放入 models/ 目录:

bash
# 下载 Faster-Whisper Medium 权重
git clone https://huggingface.co/Systran/faster-whisper-medium models/faster-whisper-medium

# X-ASR 流式模型
# 将 tokens.txt, encoder-160ms.onnx, decoder-160ms.onnx, joiner-160ms.onnx 放入 models/chunk-160ms-model/

4. 启动服务 ​

通过 Uvicorn 启动 FastAPI 网关:

bash
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

5. 前端 Web 控制台开发 ​

前端仪表盘基于 Vue 3 + Vite 构建:

bash
cd web
npm install
npm run dev   # 开发服务器运行于 http://localhost:5173 并自动代理请求至 :8000