Instructions to use MoYoYoTech/Translator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use MoYoYoTech/Translator with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="MoYoYoTech/Translator", filename="moyoyo_asr_models/qwen2.5-1.5b-instruct-q5_0.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use MoYoYoTech/Translator with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf MoYoYoTech/Translator:Q5_0 # Run inference directly in the terminal: llama-cli -hf MoYoYoTech/Translator:Q5_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf MoYoYoTech/Translator:Q5_0 # Run inference directly in the terminal: llama-cli -hf MoYoYoTech/Translator:Q5_0
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/Translator:Q5_0 # Run inference directly in the terminal: ./llama-cli -hf MoYoYoTech/Translator:Q5_0
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/Translator:Q5_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf MoYoYoTech/Translator:Q5_0
Use Docker
docker model run hf.co/MoYoYoTech/Translator:Q5_0
- LM Studio
- Jan
- Ollama
How to use MoYoYoTech/Translator with Ollama:
ollama run hf.co/MoYoYoTech/Translator:Q5_0
- Unsloth Studio new
How to use MoYoYoTech/Translator 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/Translator 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/Translator to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MoYoYoTech/Translator to start chatting
- Pi new
How to use MoYoYoTech/Translator with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf MoYoYoTech/Translator:Q5_0
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/Translator:Q5_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use MoYoYoTech/Translator 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/Translator:Q5_0
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/Translator:Q5_0
Run Hermes
hermes
- Docker Model Runner
How to use MoYoYoTech/Translator with Docker Model Runner:
docker model run hf.co/MoYoYoTech/Translator:Q5_0
- Lemonade
How to use MoYoYoTech/Translator with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MoYoYoTech/Translator:Q5_0
Run and chat with the model
lemonade run user.Translator-Q5_0
List all available models
lemonade list
daihui.zhang commited on
Commit ·
7e7b241
1
Parent(s): 38260dc
update vad config parameter
Browse files
transcribe/pipelines/pipe_vad.py
CHANGED
|
@@ -17,12 +17,12 @@ class VadPipe(BasePipe):
|
|
| 17 |
def init(cls):
|
| 18 |
if cls.model is None:
|
| 19 |
cls.model = SileroVADProcessor(
|
| 20 |
-
activate_threshold=0.
|
| 21 |
-
fusion_threshold=0.
|
| 22 |
-
min_speech_duration=0.
|
| 23 |
-
max_speech_duration=20,
|
| 24 |
-
min_silence_duration=
|
| 25 |
-
sample_rate=cls.sample_rate
|
| 26 |
)
|
| 27 |
cls.vac = FixedVADIterator(cls.model.silero_vad, sampling_rate=cls.sample_rate,)
|
| 28 |
cls.vac.reset_states()
|
|
|
|
| 17 |
def init(cls):
|
| 18 |
if cls.model is None:
|
| 19 |
cls.model = SileroVADProcessor(
|
| 20 |
+
activate_threshold=0.4, # 降低以捕获更多音频
|
| 21 |
+
fusion_threshold=0.45, # 提高以更好地融合语音片段
|
| 22 |
+
min_speech_duration=0.2, # 略微降低以捕获短音节
|
| 23 |
+
max_speech_duration=20, # 保持不变
|
| 24 |
+
min_silence_duration=300, # 增加到300毫秒,允许说话间的自然停顿
|
| 25 |
+
sample_rate=cls.sample_rate # 采样率,音频信号的采样频率
|
| 26 |
)
|
| 27 |
cls.vac = FixedVADIterator(cls.model.silero_vad, sampling_rate=cls.sample_rate,)
|
| 28 |
cls.vac.reset_states()
|
transcribe/whisper_llm_serve.py
CHANGED
|
@@ -146,7 +146,7 @@ class PyWhiperCppServe(ServeClientBase):
|
|
| 146 |
return None, left_watch_string, right_watch_string, is_end_sentence
|
| 147 |
|
| 148 |
def speech_to_text(self):
|
| 149 |
-
|
| 150 |
while not self._translate_thread_stop.is_set():
|
| 151 |
if self.exit:
|
| 152 |
logger.info("Exiting speech to text thread")
|
|
@@ -154,13 +154,14 @@ class PyWhiperCppServe(ServeClientBase):
|
|
| 154 |
|
| 155 |
if self.frames_np is None :
|
| 156 |
time.sleep(0.02) # wait for any audio to arrive
|
|
|
|
| 157 |
continue
|
| 158 |
-
|
| 159 |
audio_buffer = self.get_audio_chunk_for_processing()
|
| 160 |
-
|
| 161 |
-
if audio_duration<0.5 :
|
| 162 |
time.sleep(0.02) # wait for any audio to arrive
|
| 163 |
continue
|
|
|
|
| 164 |
# c+= 1
|
| 165 |
# name = f"dev-{c}.wav"
|
| 166 |
# save_to_wave(name, audio_buffer)
|
|
@@ -173,8 +174,8 @@ class PyWhiperCppServe(ServeClientBase):
|
|
| 173 |
# break
|
| 174 |
# except Exception as e:
|
| 175 |
# logger.error(f"{e}")
|
| 176 |
-
if (time_delay := (1 - audio_duration)) > 0:
|
| 177 |
-
|
| 178 |
|
| 179 |
def handle_transcription_output(self, segments, audio_buffer):
|
| 180 |
texts = self.text_sep.join(i.text for i in segments)
|
|
@@ -242,15 +243,18 @@ class PyWhiperCppServe(ServeClientBase):
|
|
| 242 |
|
| 243 |
def get_audio_chunk_for_processing(self):
|
| 244 |
self.vad_merge()
|
| 245 |
-
|
| 246 |
frames = self.frames_np.copy()
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
| 254 |
|
| 255 |
def stop(self):
|
| 256 |
self._translate_thread_stop.set()
|
|
|
|
| 146 |
return None, left_watch_string, right_watch_string, is_end_sentence
|
| 147 |
|
| 148 |
def speech_to_text(self):
|
| 149 |
+
c = 0
|
| 150 |
while not self._translate_thread_stop.is_set():
|
| 151 |
if self.exit:
|
| 152 |
logger.info("Exiting speech to text thread")
|
|
|
|
| 154 |
|
| 155 |
if self.frames_np is None :
|
| 156 |
time.sleep(0.02) # wait for any audio to arrive
|
| 157 |
+
logger.info("waiting for client data...")
|
| 158 |
continue
|
| 159 |
+
|
| 160 |
audio_buffer = self.get_audio_chunk_for_processing()
|
| 161 |
+
if audio_buffer is None:
|
|
|
|
| 162 |
time.sleep(0.02) # wait for any audio to arrive
|
| 163 |
continue
|
| 164 |
+
|
| 165 |
# c+= 1
|
| 166 |
# name = f"dev-{c}.wav"
|
| 167 |
# save_to_wave(name, audio_buffer)
|
|
|
|
| 174 |
# break
|
| 175 |
# except Exception as e:
|
| 176 |
# logger.error(f"{e}")
|
| 177 |
+
# if (time_delay := (1 - audio_duration)) > 0:
|
| 178 |
+
# time.sleep(time_delay)
|
| 179 |
|
| 180 |
def handle_transcription_output(self, segments, audio_buffer):
|
| 181 |
texts = self.text_sep.join(i.text for i in segments)
|
|
|
|
| 243 |
|
| 244 |
def get_audio_chunk_for_processing(self):
|
| 245 |
self.vad_merge()
|
| 246 |
+
silence_audio = np.zeros((self.sample_rate+1000,), dtype=np.float32)
|
| 247 |
frames = self.frames_np.copy()
|
| 248 |
+
# 添加对非常短音频的处理
|
| 249 |
+
if len(frames) <= 100:
|
| 250 |
+
# 对于极短的音频段(<=100帧),直接返回空音频
|
| 251 |
+
self.update_audio_buffer(len(frames))
|
| 252 |
+
return None
|
| 253 |
+
elif len(frames) < self.sample_rate:
|
| 254 |
+
silence_audio[-len(frames):] = frames
|
| 255 |
+
return silence_audio.copy()
|
| 256 |
+
return frames.copy()
|
| 257 |
+
|
| 258 |
|
| 259 |
def stop(self):
|
| 260 |
self._translate_thread_stop.set()
|