Text-to-Speech
Transformers
ONNX
GGUF
Chinese
English
voice-dialogue
speech-recognition
large-language-model
asr
tts
llm
chinese
english
real-time
conversational
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
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
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
liumaolin commited on
Commit ·
e3d17e2
1
Parent(s): 08fc60d
重构处理LLM生成chunk内容的方法,以提高文本生成的准确性。
Browse files
src/voice_dialogue/services/text/generator.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import copy
|
| 2 |
import time
|
|
|
|
| 3 |
from queue import Queue, Empty
|
| 4 |
|
| 5 |
from langchain.memory import ConversationBufferWindowMemory
|
|
@@ -99,12 +100,30 @@ class LLMResponseGenerator(BaseThread):
|
|
| 99 |
"""重置 chunks 列表"""
|
| 100 |
return [remain_content] if remain_content else []
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
def _process_chunk_content(self, chunk_content: str) -> tuple:
|
| 103 |
-
"""处理 chunk 内容,
|
| 104 |
-
if
|
| 105 |
-
return
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
def _process_voice_task(self, voice_task: VoiceTask) -> None:
|
| 110 |
"""处理单个语音任务"""
|
|
@@ -140,8 +159,11 @@ class LLMResponseGenerator(BaseThread):
|
|
| 140 |
|
| 141 |
chunk_content = f'{chunk.content}'
|
| 142 |
|
| 143 |
-
sentence_end_mark, remain_content = self._process_chunk_content(chunk_content)
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
sentence = preprocess_sentence_text(chunks)
|
| 147 |
if not sentence:
|
|
|
|
| 1 |
import copy
|
| 2 |
import time
|
| 3 |
+
import unicodedata
|
| 4 |
from queue import Queue, Empty
|
| 5 |
|
| 6 |
from langchain.memory import ConversationBufferWindowMemory
|
|
|
|
| 100 |
"""重置 chunks 列表"""
|
| 101 |
return [remain_content] if remain_content else []
|
| 102 |
|
| 103 |
+
def _is_punctuation(self, char: str) -> bool:
|
| 104 |
+
"""判断一个字符是否是标点符号"""
|
| 105 |
+
if not char or len(char) != 1:
|
| 106 |
+
return False
|
| 107 |
+
# 检查字符的 Unicode 类别是否为标点符号 (Punctuation)
|
| 108 |
+
return unicodedata.category(char).startswith('P')
|
| 109 |
+
|
| 110 |
def _process_chunk_content(self, chunk_content: str) -> tuple:
|
| 111 |
+
"""处理 chunk 内容,从右到左找标点符号并分割成三部分"""
|
| 112 |
+
if not chunk_content:
|
| 113 |
+
return '', '', ''
|
| 114 |
+
|
| 115 |
+
# 从右到左迭代,找到第一个标点符号
|
| 116 |
+
for i in range(len(chunk_content) - 1, -1, -1):
|
| 117 |
+
char = chunk_content[i]
|
| 118 |
+
if self._is_punctuation(char):
|
| 119 |
+
# 找到标点符号,分割成三部分
|
| 120 |
+
before_punct = chunk_content[:i] # 标点之前的部分
|
| 121 |
+
punct = char # 标点符号本身
|
| 122 |
+
after_punct = chunk_content[i + 1:] # 标点之后的部分
|
| 123 |
+
return before_punct, punct, after_punct
|
| 124 |
+
|
| 125 |
+
# 如果没有找到标点符号,返回整个内容作为第一部分
|
| 126 |
+
return chunk_content, '', ''
|
| 127 |
|
| 128 |
def _process_voice_task(self, voice_task: VoiceTask) -> None:
|
| 129 |
"""处理单个语音任务"""
|
|
|
|
| 159 |
|
| 160 |
chunk_content = f'{chunk.content}'
|
| 161 |
|
| 162 |
+
before_punct, sentence_end_mark, remain_content = self._process_chunk_content(chunk_content)
|
| 163 |
+
if before_punct:
|
| 164 |
+
chunks.append(before_punct)
|
| 165 |
+
if sentence_end_mark:
|
| 166 |
+
chunks.append(sentence_end_mark)
|
| 167 |
|
| 168 |
sentence = preprocess_sentence_text(chunks)
|
| 169 |
if not sentence:
|