Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ voxcpm.egg-info
.DS_Store
./pretrained_models/
app_local.py
.voxcpm-phone-profiles/
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,29 @@ python app.py --device auto

Supported values are `auto`, `cpu`, `mps`, `cuda`, and `cuda:N`. On Apple Silicon Macs, `auto` uses MPS when available.

### Phone Assistant Bridge

For a mobile-first assistant flow with voice input, webhook-backed replies, and VoxCPM voice cloning:

```bash
voxcpm-assistant --port 8809
```

Use a clean reference sample plus an exact transcript for the highest-quality cloned voice. If you connect a webhook, the app POSTs the user message and conversation history and expects a reply in plain text or in a `reply` field.
If you want phone microphone dictation, install the optional ASR dependency separately with `pip install funasr`.
You can also save a named voice enrollment once and reuse it later from the app's profile panel. Pass `--default-profile-name <name>` to auto-load a saved profile on start.

To wire in an assistant backend automatically, set `ASSISTANT_BACKEND_URL` plus optional `ASSISTANT_BACKEND_TOKEN`, `ASSISTANT_CONTEXT`, `ASSISTANT_BACKEND_MODE=auto|openai|custom`, and `ASSISTANT_BACKEND_MODEL` (model name for OpenAI-compatible endpoints, default `assistant`) before launching.

To stage each turn to a capture webhook, also set `CAPTURE_WEBHOOK_URL` plus optional `CAPTURE_WEBHOOK_TOKEN`. The assistant POSTs a neutral, backend-agnostic capture event:

```json
{"source": "voxcpm-phone-assistant", "type": "text", "timestamp": "...",
"message": "...", "reply": "...", "profile": "...", "turn": 1}
```

Mapping this onto a specific ingestion schema (field renames, classification, validation) is the receiving webhook's responsibility.

### 🚢 Production Deployment (Nano-vLLM)

For high-throughput serving, use **[Nano-vLLM-VoxCPM](https://github.com/a710128/nanovllm-voxcpm)** — a dedicated inference engine built on Nano-vLLM with concurrent request support and an async API.
Expand Down Expand Up @@ -627,4 +650,4 @@ VoxCPM model weights and code are open-sourced under the [Apache-2.0](LICENSE) l

## ⭐ Star History

[Star History Chart](https://star-history.com/#OpenBMB/VoxCPM&Date)
[Star History Chart](https://star-history.com/#OpenBMB/VoxCPM&Date)
10 changes: 9 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
import numpy as np
import gradio as gr
from typing import Optional, Tuple
from funasr import AutoModel
from pathlib import Path

try:
from funasr import AutoModel
except ImportError: # Optional dependency for ASR-assisted prompt transcription
AutoModel = None

os.environ["TOKENIZERS_PARALLELISM"] = "false"

import voxcpm
Expand Down Expand Up @@ -245,6 +249,10 @@ def get_or_load_voxcpm(self) -> voxcpm.VoxCPM:
return self.voxcpm_model

def get_or_load_asr_model(self) -> AutoModel:
if AutoModel is None:
raise RuntimeError(
"funasr is not installed. Install the optional ASR dependency to enable prompt transcription."
)
if self.asr_model is not None:
return self.asr_model
logger.info(
Expand Down
10 changes: 9 additions & 1 deletion lora_ft_webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
from voxcpm.core import VoxCPM
from voxcpm.model.voxcpm import LoRAConfig
import numpy as np
from funasr import AutoModel

try:
from funasr import AutoModel
except ImportError: # Optional dependency for ASR-assisted prompt transcription
AutoModel = None

# --- Localization ---
LANG_DICT = {
Expand Down Expand Up @@ -121,6 +125,10 @@ def detect_sample_rate(pretrained_path: str) -> Optional[int]:

def get_or_load_asr_model():
global asr_model
if AutoModel is None:
raise RuntimeError(
"funasr is not installed. Install the optional ASR dependency to enable prompt transcription."
)
if asr_model is None:
print("Loading ASR model (SenseVoiceSmall)...", file=sys.stderr)
device = "cuda:0" if torch.cuda.is_available() else "cpu"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ dependencies = [
"soundfile",
"librosa",
"matplotlib",
"funasr",
"spaces",
"argbind",
"safetensors"
Expand All @@ -62,6 +61,7 @@ dev = [

[project.scripts]
voxcpm = "voxcpm.cli:main"
voxcpm-assistant = "voxcpm.phone_assistant:main"

[project.urls]
Homepage = "https://github.com/OpenBMB/VoxCPM"
Expand Down
Loading