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)
12345import pathlibBASE_DIR = pathlib.Path(__file__).parentMODEL_DIR = BASE_DIR / "moyoyo_asr_models"123456789101112131415import pathlibimport logginglogging.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"
123from transcribe.client import TranscriptionClientclient = TranscriptionClient(1234from transcribe.client import TranscriptionClientclient = TranscriptionClient(
13 unmodified lines141516171819154 unmodified lines17417517617717817918018113 unmodified linesfrom websockets.exceptions import ConnectionClosedfrom websockets.sync.server import servefrom uuid import uuid1logging.basicConfig(level=logging.INFO)154 unmodified linesframe_data = websocket.recv()if frame_data == b"END_OF_AUDIO":return False# return np.frombuffer(frame_data, dtype=np.int16).astype(np.float32) / 32768.0return np.frombuffer(frame_data, dtype=np.float32)def handle_new_connection(self, websocket):13 unmodified lines1415161718192021154 unmodified lines17617717817918018118218313 unmodified linesfrom websockets.exceptions import ConnectionClosedfrom websockets.sync.server import servefrom uuid import uuid1logging.basicConfig(level=logging.INFO)154 unmodified linesframe_data = websocket.recv()if frame_data == b"END_OF_AUDIO":return Falsereturn 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):
12345678import osimport textwrapfrom pathlib import Pathimport avdef clear_screen():123456789101112131415import osimport textwrapfrom pathlib import Pathimport loggingimport 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 lines192021222324252627105 unmodified lines13313413513613713813917 unmodified lines15715815916016116216333 unmodified lines1971981992002012022037 unmodified lines21121221321421521621738 unmodified lines2562572582592602612622631 unmodified line26526626726826927027127257 unmodified lines33033133233333433533633733833934018 unmodified lines3593603613623633643654 unmodified lines3703713723733743753765 unmodified lines38238338438538638738818 unmodified linesfrom queue import Queuefrom scipy.io.wavfile import writefrom api_model import TransResult, Messagelogger = getLogger(__name__)def save_to_wave(filename, data:np.ndarray, sample_rate=16000):write(filename, sample_rate, data)105 unmodified lines# init llamacppcls.llm_model = QwenTranslator(config.LLM_MODEL_PATH, config.LLM_SYS_PROMPT)# cls.vad_model = VoiceActivityDetector()event.set()17 unmodified linesraise ValueError(f"Unsupported language : {language}")@classmethoddef inference(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, ))self._pool.submit(PywhisperInference.init)logger.info('Create a process to process audio.')self.send_ready_state()7 unmodified linesdef send_ready_state(self):self._ready_state.wait()self.websocket.send(json.dumps({"uid": self.client_uid,"message": self.SERVER_READY,38 unmodified linesArgs:audio_buffer (np.array): The audio chunk to transcribe."""transcribe_fut = self._pool.submit(PywhisperInference.inference, audio_buffer.tobytes(), self.language)segments = transcribe_fut.result()return segments1 unmodified line"""translate the text to dst lang"""# return "sample english"translate_fut = self._pool.submit(PywhisperInference.translate, text, self.language, self.dst_lang)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")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:breakexcept Exception as e:18 unmodified linesif is_end_sentence and last_cut_index:message = self._segment_manager.segmentseg_id = self._segment_manager.get_seg_id() - 1logger.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}")yield TransResult(seg_id=seg_id+1,context=self._segment_manager.string,5 unmodified lineselse:seg_id = self._segment_manager.get_seg_id()message = self._segment_manager.short_sentence + self._segment_manager.stringlogger.info(f"{seg_id}, {message}")yield TransResult(seg_id=seg_id,context=message,18 unmodified lines192021222324252627105 unmodified lines13313413513613713817 unmodified lines15615715815916016116233 unmodified lines1961971981992002012022032042057 unmodified lines21321421521621721838 unmodified lines2572582592602612622632642652662672682692701 unmodified line27227327427527627727827928028128228357 unmodified lines34134234334434534634734834935018 unmodified lines3693703713723733743754 unmodified lines3803813823833843853865 unmodified lines39239339439539639739818 unmodified linesfrom queue import Queuefrom scipy.io.wavfile import writefrom api_model import TransResult, Messagefrom .utils import log_blocklogger = getLogger("TranslatorApp")def save_to_wave(filename, data:np.ndarray, sample_rate=16000):write(filename, sample_rate, data)105 unmodified lines# init llamacppcls.llm_model = QwenTranslator(config.LLM_MODEL_PATH, config.LLM_SYS_PROMPT)# cls.vad_model = VoiceActivityDetector()event.set()17 unmodified linesraise ValueError(f"Unsupported language : {language}")@classmethoddef 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,))self._pool.submit(PywhisperInference.init)logger.info('Create a process to process audio.')self.send_ready_state()7 unmodified linesdef send_ready_state(self):self._ready_state.wait()self.websocket.send(json.dumps({"uid": self.client_uid,"message": self.SERVER_READY,38 unmodified linesArgs: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.transcribe, audio_buffer.tobytes(), self.language)log_block("Whisper transcrible time", f"{(time.perf_counter() - start_time):.3f}", "s")segments = transcribe_fut.result()return segments1 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"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:breakexcept Exception as e:18 unmodified linesif is_end_sentence and last_cut_index:message = self._segment_manager.segmentseg_id = self._segment_manager.get_seg_id() - 1# 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}")yield TransResult(seg_id=seg_id+1,context=self._segment_manager.string,5 unmodified lineselse:seg_id = self._segment_manager.get_seg_id()message = self._segment_manager.short_sentence + self._segment_manager.string# 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