Instructions to use MoYoYoTech/VoiceDialogue with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MoYoYoTech/VoiceDialogue with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="MoYoYoTech/VoiceDialogue") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MoYoYoTech/VoiceDialogue", dtype="auto") - llama-cpp-python
How to use MoYoYoTech/VoiceDialogue with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="MoYoYoTech/VoiceDialogue", filename="assets/models/llm/qwen/Qwen3-8B-Q6_K.gguf", )
llm.create_chat_completion( messages = "\"The answer to the universe is 42\"" )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use MoYoYoTech/VoiceDialogue with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf MoYoYoTech/VoiceDialogue:Q6_K # Run inference directly in the terminal: llama-cli -hf MoYoYoTech/VoiceDialogue:Q6_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf MoYoYoTech/VoiceDialogue:Q6_K # Run inference directly in the terminal: llama-cli -hf MoYoYoTech/VoiceDialogue:Q6_K
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf MoYoYoTech/VoiceDialogue:Q6_K # Run inference directly in the terminal: ./llama-cli -hf MoYoYoTech/VoiceDialogue:Q6_K
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf MoYoYoTech/VoiceDialogue:Q6_K # Run inference directly in the terminal: ./build/bin/llama-cli -hf MoYoYoTech/VoiceDialogue:Q6_K
Use Docker
docker model run hf.co/MoYoYoTech/VoiceDialogue:Q6_K
- LM Studio
- Jan
- Ollama
How to use MoYoYoTech/VoiceDialogue with Ollama:
ollama run hf.co/MoYoYoTech/VoiceDialogue:Q6_K
- Unsloth Studio new
How to use MoYoYoTech/VoiceDialogue with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MoYoYoTech/VoiceDialogue to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MoYoYoTech/VoiceDialogue to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MoYoYoTech/VoiceDialogue to start chatting
- Pi new
How to use MoYoYoTech/VoiceDialogue with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf MoYoYoTech/VoiceDialogue:Q6_K
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "MoYoYoTech/VoiceDialogue:Q6_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use MoYoYoTech/VoiceDialogue with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf MoYoYoTech/VoiceDialogue:Q6_K
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default MoYoYoTech/VoiceDialogue:Q6_K
Run Hermes
hermes
- Docker Model Runner
How to use MoYoYoTech/VoiceDialogue with Docker Model Runner:
docker model run hf.co/MoYoYoTech/VoiceDialogue:Q6_K
- Lemonade
How to use MoYoYoTech/VoiceDialogue with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MoYoYoTech/VoiceDialogue:Q6_K
Run and chat with the model
lemonade run user.VoiceDialogue-Q6_K
List all available models
lemonade list
Standardize service lifecycle management by replacing `stop` with `exit` and introducing `is_exited` check
Browse files- Replace `stopped` with `is_exited` across all services for consistency and clarity.
- Add `_exit_event` in `core/base.py` for improved control over service termination.
- Update related methods and properties across audio, text, and speech services.
- Refactor system routes to align with new service lifecycle methods.
- src/voice_dialogue/api/core/service_manager.py +1 -1
- src/voice_dialogue/api/routes/system_routes.py +1 -1
- src/voice_dialogue/core/base.py +18 -5
- src/voice_dialogue/services/audio/capture.py +1 -1
- src/voice_dialogue/services/audio/generator.py +1 -1
- src/voice_dialogue/services/audio/player.py +5 -3
- src/voice_dialogue/services/speech/monitor.py +1 -1
- src/voice_dialogue/services/speech/recognizer.py +1 -1
- src/voice_dialogue/services/text/generator.py +1 -1
|
@@ -115,7 +115,7 @@ class ServiceManager:
|
|
| 115 |
service = self.services[service_name]
|
| 116 |
logger.info(f"正在停止服务: {service_name}")
|
| 117 |
|
| 118 |
-
service.
|
| 119 |
|
| 120 |
# 等待服务停止(最多等待5秒)
|
| 121 |
timeout = 5
|
|
|
|
| 115 |
service = self.services[service_name]
|
| 116 |
logger.info(f"正在停止服务: {service_name}")
|
| 117 |
|
| 118 |
+
service.exit()
|
| 119 |
|
| 120 |
# 等待服务停止(最多等待5秒)
|
| 121 |
timeout = 5
|
|
@@ -120,7 +120,7 @@ async def stop_system(request: Request):
|
|
| 120 |
audio_capture_service = service_manager.get_service("audio_capture")
|
| 121 |
if audio_capture_service:
|
| 122 |
try:
|
| 123 |
-
audio_capture_service.
|
| 124 |
logger.info("音频捕获服务已停止")
|
| 125 |
|
| 126 |
# 等待服务停止
|
|
|
|
| 120 |
audio_capture_service = service_manager.get_service("audio_capture")
|
| 121 |
if audio_capture_service:
|
| 122 |
try:
|
| 123 |
+
audio_capture_service.exit()
|
| 124 |
logger.info("音频捕获服务已停止")
|
| 125 |
|
| 126 |
# 等待服务停止
|
|
@@ -5,14 +5,17 @@ class BaseThread(threading.Thread):
|
|
| 5 |
|
| 6 |
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None):
|
| 7 |
super().__init__(group, target, name, args, kwargs, daemon=daemon)
|
| 8 |
-
|
|
|
|
| 9 |
self._is_ready_event = threading.Event()
|
|
|
|
| 10 |
|
| 11 |
-
def
|
| 12 |
-
self.
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
@property
|
| 18 |
def is_ready(self):
|
|
@@ -24,3 +27,13 @@ class BaseThread(threading.Thread):
|
|
| 24 |
self._is_ready_event.set()
|
| 25 |
else:
|
| 26 |
self._is_ready_event.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None):
|
| 7 |
super().__init__(group, target, name, args, kwargs, daemon=daemon)
|
| 8 |
+
|
| 9 |
+
self._exit_event = threading.Event()
|
| 10 |
self._is_ready_event = threading.Event()
|
| 11 |
+
self._stop_event = threading.Event()
|
| 12 |
|
| 13 |
+
def exit(self):
|
| 14 |
+
self._exit_event.set()
|
| 15 |
|
| 16 |
+
@property
|
| 17 |
+
def is_exited(self):
|
| 18 |
+
return self._exit_event.is_set()
|
| 19 |
|
| 20 |
@property
|
| 21 |
def is_ready(self):
|
|
|
|
| 27 |
self._is_ready_event.set()
|
| 28 |
else:
|
| 29 |
self._is_ready_event.clear()
|
| 30 |
+
|
| 31 |
+
def stop(self):
|
| 32 |
+
self._stop_event.set()
|
| 33 |
+
|
| 34 |
+
@property
|
| 35 |
+
def is_stopped(self):
|
| 36 |
+
return self._stop_event.is_set()
|
| 37 |
+
|
| 38 |
+
def resume(self):
|
| 39 |
+
self._stop_event.clear()
|
|
@@ -47,7 +47,7 @@ class EchoCancellingAudioCapture(BaseThread):
|
|
| 47 |
self.is_ready = True
|
| 48 |
|
| 49 |
try:
|
| 50 |
-
while not self.
|
| 51 |
size = ctypes.c_int(0)
|
| 52 |
is_voice_active = ctypes.c_bool(False)
|
| 53 |
# 获取音频数据
|
|
|
|
| 47 |
self.is_ready = True
|
| 48 |
|
| 49 |
try:
|
| 50 |
+
while not self.is_exited:
|
| 51 |
size = ctypes.c_int(0)
|
| 52 |
is_voice_active = ctypes.c_bool(False)
|
| 53 |
# 获取音频数据
|
|
@@ -57,7 +57,7 @@ class TTSAudioGenerator(BaseThread):
|
|
| 57 |
|
| 58 |
self.is_ready = True
|
| 59 |
|
| 60 |
-
while not self.
|
| 61 |
try:
|
| 62 |
voice_task: VoiceTask = self.text_input_queue.get(block=False, timeout=0.1)
|
| 63 |
except Empty:
|
|
|
|
| 57 |
|
| 58 |
self.is_ready = True
|
| 59 |
|
| 60 |
+
while not self.is_exited:
|
| 61 |
try:
|
| 62 |
voice_task: VoiceTask = self.text_input_queue.get(block=False, timeout=0.1)
|
| 63 |
except Empty:
|
|
@@ -29,7 +29,7 @@ class AudioStreamPlayer(BaseThread):
|
|
| 29 |
def run(self):
|
| 30 |
self.is_ready = True
|
| 31 |
|
| 32 |
-
while not self.
|
| 33 |
|
| 34 |
try:
|
| 35 |
voice_task: VoiceTask = self.audio_playing_queue.get(block=False, timeout=0.1)
|
|
@@ -82,8 +82,10 @@ class AudioStreamPlayer(BaseThread):
|
|
| 82 |
|
| 83 |
voice_state_manager.set_audio_playing(task_id)
|
| 84 |
voice_state_manager.reset_task_id()
|
| 85 |
-
|
| 86 |
-
self.
|
|
|
|
|
|
|
| 87 |
|
| 88 |
if self.audio_playing_queue.empty():
|
| 89 |
print(f'回答播放完了')
|
|
|
|
| 29 |
def run(self):
|
| 30 |
self.is_ready = True
|
| 31 |
|
| 32 |
+
while not self.is_exited:
|
| 33 |
|
| 34 |
try:
|
| 35 |
voice_task: VoiceTask = self.audio_playing_queue.get(block=False, timeout=0.1)
|
|
|
|
| 82 |
|
| 83 |
voice_state_manager.set_audio_playing(task_id)
|
| 84 |
voice_state_manager.reset_task_id()
|
| 85 |
+
|
| 86 |
+
if not self.is_stopped:
|
| 87 |
+
audio_data, sample_rate = voice_task.tts_generated_sentence_audio
|
| 88 |
+
self.playing_audio(audio_data, sample_rate)
|
| 89 |
|
| 90 |
if self.audio_playing_queue.empty():
|
| 91 |
print(f'回答播放完了')
|
|
@@ -217,7 +217,7 @@ class SpeechStateMonitor(BaseThread):
|
|
| 217 |
is_audio_sent_for_processing = False
|
| 218 |
is_audio_frames_empty = True
|
| 219 |
|
| 220 |
-
while not self.
|
| 221 |
try:
|
| 222 |
# 1. 管理任务生命周期
|
| 223 |
self.task_id = voice_state_manager.task_id
|
|
|
|
| 217 |
is_audio_sent_for_processing = False
|
| 218 |
is_audio_frames_empty = True
|
| 219 |
|
| 220 |
+
while not self.is_exited:
|
| 221 |
try:
|
| 222 |
# 1. 管理任务生命周期
|
| 223 |
self.task_id = voice_state_manager.task_id
|
|
@@ -31,7 +31,7 @@ class ASRWorker(BaseThread):
|
|
| 31 |
|
| 32 |
self.is_ready = True
|
| 33 |
|
| 34 |
-
while not self.
|
| 35 |
try:
|
| 36 |
voice_task: VoiceTask = self.user_voice_queue.get(block=False, timeout=0.1)
|
| 37 |
except Empty:
|
|
|
|
| 31 |
|
| 32 |
self.is_ready = True
|
| 33 |
|
| 34 |
+
while not self.is_exited:
|
| 35 |
try:
|
| 36 |
voice_task: VoiceTask = self.user_voice_queue.get(block=False, timeout=0.1)
|
| 37 |
except Empty:
|
|
@@ -202,7 +202,7 @@ class LLMResponseGenerator(BaseThread):
|
|
| 202 |
self.is_ready = True
|
| 203 |
|
| 204 |
"""主运行循环"""
|
| 205 |
-
while not self.
|
| 206 |
try:
|
| 207 |
voice_task: VoiceTask = self.user_question_queue.get(block=False, timeout=0.1)
|
| 208 |
self._process_voice_task(voice_task)
|
|
|
|
| 202 |
self.is_ready = True
|
| 203 |
|
| 204 |
"""主运行循环"""
|
| 205 |
+
while not self.is_exited:
|
| 206 |
try:
|
| 207 |
voice_task: VoiceTask = self.user_question_queue.get(block=False, timeout=0.1)
|
| 208 |
self._process_voice_task(voice_task)
|