原始碼與 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.txt3. 下載模型權重
根據 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 --reload5. 前端 Web 控制台開發
前端儀表板基於 Vue 3 + Vite 建置:
bash
cd web
npm install
npm run dev # 開發伺服器執行於 http://localhost:5173 並自動代理請求至 :8000