2025年12月17日 星期三

WhisperLiveKit + 聯發科Breeze ASR 25

WhisperLiveKit + 聯發科Breeze ASR 25

參考來源

WhisperLiveKit
Breeze-ASR-25

設置流程

  1. 首先clone案至本機
git clone https://github.com/QuentinFuxa/WhisperLiveKit.git
  1. 調整Dockerfile,加入安裝safetensors
...(前略)
# timeout/retries for large torch wheels
RUN pip3 install --upgrade pip setuptools wheel && \
    pip3 --disable-pip-version-check install --timeout=120 --retries=5 \
        --index-url https://download.pytorch.org/whl/cu129 \
        torch torchaudio \
    || (echo "Initial install failed — retrying with extended timeout..." && \
        pip3 --disable-pip-version-check install --timeout=300 --retries=3 \
            --index-url https://download.pytorch.org/whl/cu129 \
            torch torchvision torchaudio)
# 加入這段            
RUN pip3 install safetensors 
...(後略)
COPY . .
  1. 產出image,我加入-safetensors來做自己版本識別使用
docker build -t wlk-safetensors .
  1. 安裝huggingface cli
curl -LsSf https://hf.co/cli/install.sh | bash
  1. 利用huggingface cli下載聯發科Breeze ASR
    請注意,--local-dir後面請調整為你的實際保存位置
env PATH="$HOME/.local/bin:$PATH" hf download   MediaTek-Research/Breeze-ASR-25   --local-dir /home/marty/large_files/Breeze-ASR-25
  1. docker run啟動容器
    data volume(-v) 與 port(-p) 的部份請根據你的實際狀況調整
docker run --rm --gpus all   -p 8081:8000   -v /home/marty/large_files/Breeze-ASR-25:/models/Breeze-ASR-25   -v /home/marty/.cache/whisper:/root/.cache/whisper   -v /home/marty/.cache/huggingface:/root/.cache/huggingface   wlk-safetensors:latest   --backend whisper   --model-path /models/Breeze-ASR-25   --language zh

啟動之後就會開始下載一個base.pt,大約130mb,然後就會看到服務啟動的訊息:

docker run --rm --gpus all   -p 8081:8000   -v /home/marty/large_files/Breeze-ASR-25:/models/Breeze-ASR-25   -v /home/marty/.cache/whisper:/root/.cache/whisper   -v /home/marty/.cache/huggingface:/root/.cache/huggingface   wlk-safetensors:latest   --backend whisper   --model-path /models/Breeze-ASR-25   --language zh
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

這邊看到的8000是容器內的對應port,現在你只要打開網頁,然後連結到你啟動服務的8081port就可以開始測試了。

記得要有麥克風就是。

沒有留言:

張貼留言