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 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
liumaolin commited on
Commit ·
d12af4f
1
Parent(s): 22a06c4
缓存user_prompts以提高性能
Browse files
src/voice_dialogue/config/user_config.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
"""用户配置管理模块"""
|
| 2 |
import json
|
| 3 |
-
from typing import Dict
|
| 4 |
|
| 5 |
-
from voice_dialogue.utils.logger import logger
|
| 6 |
from .llm_config import CHINESE_SYSTEM_PROMPT, ENGLISH_SYSTEM_PROMPT
|
| 7 |
from .paths import USER_PROMPTS_PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def get_user_prompts() -> Dict[str, str]:
|
|
@@ -12,25 +15,32 @@ def get_user_prompts() -> Dict[str, str]:
|
|
| 12 |
加载用户自定义的 prompts
|
| 13 |
|
| 14 |
Returns:
|
| 15 |
-
Dict[str, str]: 用户自定义的 prompts
|
| 16 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
if not USER_PROMPTS_PATH.exists():
|
| 18 |
-
logger.info(f"用户配置文件不存在: {USER_PROMPTS_PATH}")
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
try:
|
| 22 |
with open(USER_PROMPTS_PATH, 'r', encoding='utf-8') as f:
|
| 23 |
user_prompts = json.load(f)
|
| 24 |
-
logger.info("成功加载用户自定义 prompts")
|
| 25 |
-
|
|
|
|
| 26 |
except (json.JSONDecodeError, IOError) as e:
|
| 27 |
-
logger.error(f"无法加载用户 prompt 配置文件: {e}")
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
def save_user_prompts(prompts: Dict[str, str]) -> bool:
|
| 32 |
"""
|
| 33 |
-
保存用户自定义的 prompts 到 JSON 文件
|
| 34 |
|
| 35 |
Args:
|
| 36 |
prompts: 要保存的 prompts 字典
|
|
@@ -38,6 +48,7 @@ def save_user_prompts(prompts: Dict[str, str]) -> bool:
|
|
| 38 |
Returns:
|
| 39 |
bool: 保存是否成功
|
| 40 |
"""
|
|
|
|
| 41 |
try:
|
| 42 |
# 确保目录存在
|
| 43 |
if not USER_PROMPTS_PATH.parent.exists():
|
|
@@ -46,6 +57,7 @@ def save_user_prompts(prompts: Dict[str, str]) -> bool:
|
|
| 46 |
with open(USER_PROMPTS_PATH, 'w', encoding='utf-8') as f:
|
| 47 |
json.dump(prompts, f, ensure_ascii=False, indent=4)
|
| 48 |
logger.info(f"用户 prompts 已保存到: {USER_PROMPTS_PATH}")
|
|
|
|
| 49 |
return True
|
| 50 |
except IOError as e:
|
| 51 |
logger.error(f"无法保存用户 prompt 配置文件: {e}")
|
|
@@ -99,15 +111,17 @@ def get_raw_prompt(language: str) -> str:
|
|
| 99 |
|
| 100 |
def reset_prompts_to_default() -> bool:
|
| 101 |
"""
|
| 102 |
-
重置 prompts 为默认值
|
| 103 |
|
| 104 |
Returns:
|
| 105 |
bool: 重置是否成功
|
| 106 |
"""
|
|
|
|
| 107 |
try:
|
| 108 |
if USER_PROMPTS_PATH.exists():
|
| 109 |
USER_PROMPTS_PATH.unlink()
|
| 110 |
logger.info("用户自定义 prompts 已重置为默认值")
|
|
|
|
| 111 |
return True
|
| 112 |
except IOError as e:
|
| 113 |
logger.error(f"重置 prompts 失败: {e}")
|
|
|
|
| 1 |
"""用户配置管理模块"""
|
| 2 |
import json
|
| 3 |
+
from typing import Dict, Optional
|
| 4 |
|
|
|
|
| 5 |
from .llm_config import CHINESE_SYSTEM_PROMPT, ENGLISH_SYSTEM_PROMPT
|
| 6 |
from .paths import USER_PROMPTS_PATH
|
| 7 |
+
from ..utils.logger import logger
|
| 8 |
+
|
| 9 |
+
# 内存缓存,避免重复读取文件
|
| 10 |
+
_user_prompts_cache: Optional[Dict[str, str]] = None
|
| 11 |
|
| 12 |
|
| 13 |
def get_user_prompts() -> Dict[str, str]:
|
|
|
|
| 15 |
加载用户自定义的 prompts
|
| 16 |
|
| 17 |
Returns:
|
| 18 |
+
Dict[str, str]: 用户自定义的 prompts。
|
| 19 |
"""
|
| 20 |
+
global _user_prompts_cache
|
| 21 |
+
if _user_prompts_cache is not None:
|
| 22 |
+
return _user_prompts_cache
|
| 23 |
+
|
| 24 |
if not USER_PROMPTS_PATH.exists():
|
| 25 |
+
logger.info(f"用户配置文件不存在,使用空配置: {USER_PROMPTS_PATH}")
|
| 26 |
+
_user_prompts_cache = {}
|
| 27 |
+
return _user_prompts_cache
|
| 28 |
|
| 29 |
try:
|
| 30 |
with open(USER_PROMPTS_PATH, 'r', encoding='utf-8') as f:
|
| 31 |
user_prompts = json.load(f)
|
| 32 |
+
logger.info("成功从文件加载用户自定义 prompts 到缓存")
|
| 33 |
+
_user_prompts_cache = user_prompts
|
| 34 |
+
return _user_prompts_cache
|
| 35 |
except (json.JSONDecodeError, IOError) as e:
|
| 36 |
+
logger.error(f"无法加载用户 prompt 配置文件,使用空配置: {e}")
|
| 37 |
+
_user_prompts_cache = {}
|
| 38 |
+
return _user_prompts_cache
|
| 39 |
|
| 40 |
|
| 41 |
def save_user_prompts(prompts: Dict[str, str]) -> bool:
|
| 42 |
"""
|
| 43 |
+
保存用户自定义的 prompts 到 JSON 文件,并更新缓存。
|
| 44 |
|
| 45 |
Args:
|
| 46 |
prompts: 要保存的 prompts 字典
|
|
|
|
| 48 |
Returns:
|
| 49 |
bool: 保存是否成功
|
| 50 |
"""
|
| 51 |
+
global _user_prompts_cache
|
| 52 |
try:
|
| 53 |
# 确保目录存在
|
| 54 |
if not USER_PROMPTS_PATH.parent.exists():
|
|
|
|
| 57 |
with open(USER_PROMPTS_PATH, 'w', encoding='utf-8') as f:
|
| 58 |
json.dump(prompts, f, ensure_ascii=False, indent=4)
|
| 59 |
logger.info(f"用户 prompts 已保存到: {USER_PROMPTS_PATH}")
|
| 60 |
+
_user_prompts_cache = prompts # 更新缓存
|
| 61 |
return True
|
| 62 |
except IOError as e:
|
| 63 |
logger.error(f"无法保存用户 prompt 配置文件: {e}")
|
|
|
|
| 111 |
|
| 112 |
def reset_prompts_to_default() -> bool:
|
| 113 |
"""
|
| 114 |
+
重置 prompts 为默认值,并清空缓存。
|
| 115 |
|
| 116 |
Returns:
|
| 117 |
bool: 重置是否成功
|
| 118 |
"""
|
| 119 |
+
global _user_prompts_cache
|
| 120 |
try:
|
| 121 |
if USER_PROMPTS_PATH.exists():
|
| 122 |
USER_PROMPTS_PATH.unlink()
|
| 123 |
logger.info("用户自定义 prompts 已重置为默认值")
|
| 124 |
+
_user_prompts_cache = {} # 重置缓存为空字典
|
| 125 |
return True
|
| 126 |
except IOError as e:
|
| 127 |
logger.error(f"重置 prompts 失败: {e}")
|