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 Settings
- 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
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
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
Merge branch 'main' of hf.co:MoYoYoTech/Translator
Browse files* 'main' of hf.co:MoYoYoTech/Translator:
add custom vad silence
add custom vad silence
transcribe/pipelines/pipe_vad.py
CHANGED
|
@@ -2,10 +2,55 @@
|
|
| 2 |
from .base import MetaItem, BasePipe
|
| 3 |
from ..helpers.vadprocessor import SileroVADProcessor, FixedVADIterator
|
| 4 |
import numpy as np
|
| 5 |
-
from silero_vad import get_speech_timestamps
|
| 6 |
import torch
|
|
|
|
| 7 |
# import noisereduce as nr
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
class VadPipe(BasePipe):
|
| 11 |
model = None
|
|
@@ -46,7 +91,7 @@ class VadPipe(BasePipe):
|
|
| 46 |
speech_timestamps = get_speech_timestamps(torch.Tensor(source_audio), self.model.silero_vad, sampling_rate=16000)
|
| 47 |
|
| 48 |
if speech_timestamps:
|
| 49 |
-
send_audio =
|
| 50 |
send_audio = send_audio.numpy()
|
| 51 |
in_data.audio = send_audio
|
| 52 |
# send_audio = self.reduce_noise(send_audio).tobytes()
|
|
|
|
| 2 |
from .base import MetaItem, BasePipe
|
| 3 |
from ..helpers.vadprocessor import SileroVADProcessor, FixedVADIterator
|
| 4 |
import numpy as np
|
| 5 |
+
from silero_vad import get_speech_timestamps
|
| 6 |
import torch
|
| 7 |
+
from typing import List
|
| 8 |
# import noisereduce as nr
|
| 9 |
|
| 10 |
+
def collect_chunks(tss: List[dict], wav: torch.Tensor, sample_rate: int = 16000):
|
| 11 |
+
chunks = []
|
| 12 |
+
silent_samples = int(0.3 * sample_rate) # 300ms 的静音样本数
|
| 13 |
+
silence = torch.zeros(silent_samples) # 创建300ms的静音
|
| 14 |
+
|
| 15 |
+
for i in range(len(tss)):
|
| 16 |
+
# 先添加当前语音片段
|
| 17 |
+
chunks.append(wav[tss[i]['start']: tss[i]['end']])
|
| 18 |
+
|
| 19 |
+
# 如果不是最后一个片段,且与下一个片段间隔大于100ms,则添加静音
|
| 20 |
+
if i < len(tss) - 1:
|
| 21 |
+
gap = tss[i+1]['start'] - tss[i]['end']
|
| 22 |
+
if gap > 0.1 * sample_rate: # 判断间隔是否大于100ms
|
| 23 |
+
chunks.append(silence) # 添加300ms静音
|
| 24 |
+
|
| 25 |
+
return torch.cat(chunks)
|
| 26 |
+
|
| 27 |
+
def collect_chunks_improved(tss: List[dict], wav: torch.Tensor, sample_rate: int = 16000):
|
| 28 |
+
chunks = []
|
| 29 |
+
silent_samples = int(0.3 * sample_rate) # 300ms 的静音样本数
|
| 30 |
+
silence = torch.zeros(silent_samples) # 创建300ms的静音
|
| 31 |
+
min_gap_samples = int(0.1 * sample_rate) # 最小间隔阈值 (100ms)
|
| 32 |
+
|
| 33 |
+
# 对时间戳进行简单的平滑处理
|
| 34 |
+
smoothed_tss = []
|
| 35 |
+
for i, ts in enumerate(tss):
|
| 36 |
+
if i > 0 and ts['start'] - tss[i-1]['end'] < 0.02 * sample_rate: # 如果间隔小于20ms,认为是连续的
|
| 37 |
+
smoothed_tss[-1]['end'] = ts['end'] # 合并到前一个片段
|
| 38 |
+
else:
|
| 39 |
+
smoothed_tss.append(ts)
|
| 40 |
+
|
| 41 |
+
for i in range(len(smoothed_tss)):
|
| 42 |
+
# 添加当前语音片段
|
| 43 |
+
chunks.append(wav[smoothed_tss[i]['start']: smoothed_tss[i]['end']])
|
| 44 |
+
|
| 45 |
+
# 如果不是最后一个片段,且与下一个片段间隔大于阈值,则添加静音
|
| 46 |
+
if i < len(smoothed_tss) - 1:
|
| 47 |
+
gap = smoothed_tss[i+1]['start'] - smoothed_tss[i]['end']
|
| 48 |
+
if gap > min_gap_samples:
|
| 49 |
+
# 根据间隔大小动态调整静音长度,但最大不超过300ms
|
| 50 |
+
silence_length = min(gap // 2, silent_samples)
|
| 51 |
+
chunks.append(torch.zeros(silence_length))
|
| 52 |
+
|
| 53 |
+
return torch.cat(chunks)
|
| 54 |
|
| 55 |
class VadPipe(BasePipe):
|
| 56 |
model = None
|
|
|
|
| 91 |
speech_timestamps = get_speech_timestamps(torch.Tensor(source_audio), self.model.silero_vad, sampling_rate=16000)
|
| 92 |
|
| 93 |
if speech_timestamps:
|
| 94 |
+
send_audio = collect_chunks_improved(speech_timestamps, torch.Tensor(source_audio))
|
| 95 |
send_audio = send_audio.numpy()
|
| 96 |
in_data.audio = send_audio
|
| 97 |
# send_audio = self.reduce_noise(send_audio).tobytes()
|