Instructions to use MoYoYoTech/Translator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use MoYoYoTech/Translator with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -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 serve -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/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -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
- Llama new
- LM Studio
- Jan
- Ollama
How to use MoYoYoTech/Translator with Ollama:
ollama run hf.co/MoYoYoTech/Translator:Q5_0
- Unsloth Desktop
- 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 serve -hf MoYoYoTech/Translator:Q5_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "MoYoYoTech/Translator:Q5_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- 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
- Hermes Agent
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 serve -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:9931/v1 hermes config set model.default MoYoYoTech/Translator:Q5_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use MoYoYoTech/Translator with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MoYoYoTech/Translator:Q5_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "MoYoYoTech/Translator:Q5_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
daihui.zhang commited on
Commit ·
1f45d99
1
Parent(s): 81e4670
add logging format
Browse filesFiles changed (5)
123456789101112131415import pathlib
import logging
logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s", datefmt="%H:%M:%S")
logging.getLogger("pywhispercpp").setLevel(logging.WARNING)
BASE_DIR = pathlib.Path(__file__).parentMODEL_DIR = BASE_DIR / "moyoyo_asr_models"1234
from transcribe.client import TranscriptionClient
client = TranscriptionClient(13 unmodified lines1415161718192021154 unmodified lines17617717817717817918018118218313 unmodified linesfrom websockets.exceptions import ConnectionClosedfrom websockets.sync.server import servefrom uuid import uuid1
logging.basicConfig(level=logging.INFO)
154 unmodified lines frame_data = websocket.recv() if frame_data == b"END_OF_AUDIO": return False # return np.frombuffer(frame_data, dtype=np.int16).astype(np.float32) / 32768.0 return np.frombuffer(frame_data, dtype=np.float32) return np.frombuffer(frame_data, dtype=np.int16).astype(np.float32) / 32768.0 # return np.frombuffer(frame_data, dtype=np.float32)
def handle_new_connection(self, websocket):123456789101112131415import osimport textwrapfrom pathlib import Pathimport logging
import avdef log_block(key: str, value, unit=''): """格式化输出日志内容""" key_fmt = f"[{key.ljust(25)}]" # 左对齐填充 val_fmt = f"{value} {unit}".strip() logging.info(f"{key_fmt}: {val_fmt}")
def clear_screen():18 unmodified lines1920212223232424252627105 unmodified lines13313413513613613713817 unmodified lines15615715816015916016116233 unmodified lines1961971982001992002012022032042057 unmodified lines21321421521421621721838 unmodified lines2572582592602612622632642602652662672682692701 unmodified line27227327427527627727827928028128228357 unmodified lines34134234333334434534634733734834935018 unmodified lines3693703713623723733743754 unmodified lines3803813823733833843853865 unmodified lines39239339438539539639739818 unmodified linesfrom queue import Queuefrom scipy.io.wavfile import writefrom api_model import TransResult, Messagefrom .utils import log_block
logger = getLogger(__name__)logger = getLogger("TranslatorApp")
def save_to_wave(filename, data:np.ndarray, sample_rate=16000): write(filename, sample_rate, data)105 unmodified lines # init llamacpp cls.llm_model = QwenTranslator(config.LLM_MODEL_PATH, config.LLM_SYS_PROMPT) # cls.vad_model = VoiceActivityDetector() event.set() 17 unmodified lines raise ValueError(f"Unsupported language : {language}")
@classmethod def inference(cls, audio_buffer, language): def transcribe(cls, audio_buffer, language): max_len, prompt = cls.config_language(language) audio_buffer = np.frombuffer(audio_buffer, dtype=np.float32) return cls.whisper_model.transcribe(33 unmodified lines # 进程初始化后再开始收音频 self._ready_state = mp.Event() self._pool = PPool( max_workers=1, initializer=PywhisperInference.initializer, initargs=(self._ready_state, )) max_workers=1, initializer=PywhisperInference.initializer, initargs=(self._ready_state,) ) self._pool.submit(PywhisperInference.init) logger.info('Create a process to process audio.') self.send_ready_state()7 unmodified lines
def send_ready_state(self): self._ready_state.wait() self.websocket.send(json.dumps({ "uid": self.client_uid, "message": self.SERVER_READY,38 unmodified lines Args: audio_buffer (np.array): The audio chunk to transcribe. """
log_block("Audio buffer length", f"{audio_buffer.shape[0]/self.sample_rate:.2f}", "s") start_time = time.perf_counter()
transcribe_fut = self._pool.submit( PywhisperInference.inference, audio_buffer.tobytes(), self.language) PywhisperInference.transcribe, audio_buffer.tobytes(), self.language)
log_block("Whisper transcrible time", f"{(time.perf_counter() - start_time):.3f}", "s") segments = transcribe_fut.result() return segments 1 unmodified line """ translate the text to dst lang""" # return "sample english" log_block("LLM translate input", f"{text}") start_time = time.perf_counter() translate_fut = self._pool.submit( PywhisperInference.translate, text, self.language, self.dst_lang) log_block("LLM translate time", f"{(time.perf_counter() - start_time):.3f}", "s") return translate_fut.result() def _segments_split(self, segments, audio_buffer: np.ndarray):57 unmodified lines # name = f"dev-{c}.wav" # save_to_wave(name, audio_buffer) try: logger.info(f"Processing audio with duration: {len(audio_buffer) / self.sample_rate:.2f}s") # logger.info(f"Audio buffer length: {len(audio_buffer) / self.sample_rate:.2f}s") segments = self.transcribe_audio(audio_buffer) for tran_result in self.handle_transcription_output(segments, audio_buffer): self.send_to_client(tran_result) except KeyboardInterrupt: break except Exception as e:18 unmodified lines if is_end_sentence and last_cut_index: message = self._segment_manager.segment seg_id = self._segment_manager.get_seg_id() - 1 logger.info(f"{seg_id}, {message}") # logger.info(f"{seg_id}, {message}") yield TransResult( seg_id=seg_id, context=message,4 unmodified lines ) if self._segment_manager.string.strip(): message = self._segment_manager.string.strip() logger.info(f"{seg_id + 1}, {message}") # logger.info(f"{seg_id + 1}, {message}") yield TransResult( seg_id=seg_id+1, context=self._segment_manager.string,5 unmodified lines else: seg_id = self._segment_manager.get_seg_id() message = self._segment_manager.short_sentence + self._segment_manager.string logger.info(f"{seg_id}, {message}") # logger.info(f"{seg_id}, {message}") yield TransResult( seg_id=seg_id, context=message,config.py+10
run_client.py+1
transcribe/transcription.py+4-2
transcribe/utils.py+7
transcribe/whisper_llm_serve.py+22-12