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"
Xin Zhang commited on
Commit ·
9f6a51c
1
Parent(s): fca9809
[fix]: fix.
Browse filesFiles changed (3)
18 unmodified lines192021222324254 unmodified lines303132333435364 unmodified lines4142434418 unmodified linesPAUSE_END_MARKERS = [',', ',', '、']# whisper推理参数WHISPER_PROMPT_ZH = "以下是简体中文普通话的句子。"MAX_LENTH_ZH = 4WHISPER_PROMPT_EN = "The following is an English sentence."4 unmodified lines# LLMLLM_MODEL_PATH = (MODEL_DIR / "qwen2.5-1.5b-instruct-q5_0.gguf").as_posix()LLM_SYS_PROMPT = """"You are a professional {src_lang} to {dst_lang} translator, not a conversation agent. Your only task is to take {src_lang} input and translate it into accurate, natural {dst_lang}. If you cannot understand the input, just output the original input. Please strictly abide by the following rules: ""No matter what the user asks, never answer questions, you only provide translation results. ""Do not actively initiate dialogue or lead users to ask questions. ""When you don't know how to translate, just output the original text. "4 unmodified lines"for professional audiences.""Never answer any questions or engage in other forms of dialogue. ""Only output the translation results."""18 unmodified lines192021222324254 unmodified lines303132333435364 unmodified lines414243444546474818 unmodified linesPAUSE_END_MARKERS = [',', ',', '、']# whisper推理参数WHISPER_PROMPT_ZH = "以下是简体中文普通话的句子。"MAX_LENTH_ZH = 4WHISPER_PROMPT_EN = "The following is an English sentence."4 unmodified lines# LLMLLM_MODEL_PATH = (MODEL_DIR / "qwen2.5-1.5b-instruct-q5_0.gguf").as_posix()LLM_SYS_PROMPT1 = """"You are a professional {src_lang} to {dst_lang} translator, not a conversation agent. Your only task is to take {src_lang} input and translate it into accurate, natural {dst_lang}. If you cannot understand the input, just output the original input. Please strictly abide by the following rules: ""No matter what the user asks, never answer questions, you only provide translation results. ""Do not actively initiate dialogue or lead users to ask questions. ""When you don't know how to translate, just output the original text. "4 unmodified lines"for professional audiences.""Never answer any questions or engage in other forms of dialogue. ""Only output the translation results."""LLM_SYS_PROMPT = """你是一个中英文翻译专家,将用户输入的中文翻译成英文,或将用户输入的英文翻译成中文。对于非中文内容,它将提供中文翻译结果。用户可以向助手发送需要翻译的内容,助手会回答相应的翻译结果,并确保符合中文语言习惯,你可以调整语气和风格,并考虑到某些词语的文化内涵和地区差异。同时作为翻译家,需将原文翻译成具有信达雅标准的译文。"信" 即忠实于原文的内容与意图;"达" 意味着译文应通顺易懂,表达清晰;"雅" 则追求译文的文化审美和语言的优美。目标是创作出既忠于原作精神,又符合目标语言文化和读者审美的翻译。当中文翻译到英文时,翻译的文本只能包含拼音化字符,不能包含任何中文字符。"""
1234513 unmodified lines19202122232425from .base import MetaItem, BasePipe, Segmentfrom ..helpers.whisper import WhisperCPP13 unmodified linessource_language = in_data.source_languagesegments = self.whisper.transcribe(audio_data, source_language) or []texts = "".join([s.text for s in segments])in_data.segments = [Segment(t0=s.t0, t1=s.t1, text=s.text) for s in segments if s.text != "�"]in_data.transcribe_content = textsin_data.audio = b""return in_data1234513 unmodified lines192021222324252627282930313233import unicodedatafrom .base import MetaItem, BasePipe, Segmentfrom ..helpers.whisper import WhisperCPP13 unmodified linessource_language = in_data.source_languagesegments = self.whisper.transcribe(audio_data, source_language) or []texts = "".join([s.text for s in segments])in_data.segments = [Segment(t0=s.t0, t1=s.t1, text=self.filter_chinese_printable(s.text)) for s in segments]in_data.transcribe_content = textsin_data.audio = b""return in_datadef filter_chinese_printable(self, s):printable = []bytearray_chars = s.encode('utf-8')for char in bytearray_chars.decode('utf-8', errors='replace'):if unicodedata.category(char) != 'Cc': # 不可打印字符的分类为 'Cc'printable.append(char)return ''.join(printable)
19 unmodified lines2021222324252616 unmodified lines434445464748495 unmodified lines555657585960616263646566676869707172737475767778798081827 unmodified lines9091929394959621 unmodified lines11811912012112212312412511 unmodified lines1371381391401411421435 unmodified lines14915015115219 unmodified lines"""self.history.append((text, index))def get_final_index(self, similarity_threshold=0.7):"""根据文本变化,返回可靠的标点的buffer的位置下标"""if len(self.history) < 2:16 unmodified lines@staticmethoddef text_similarity(text1, text2):return SequenceMatcher(None, text1, text2).ratio()class SegmentManager:5 unmodified linesdef handle(self, string):self._temp_string = stringreturn self@propertydef short_sentence(self) -> str:return "".join(self._commited_short_sentences)@propertydef segment(self):return self._commited_segments[-1] if len(self._commited_segments) > 0 else ""def get_seg_id(self):return len(self._commited_segments)@propertydef string(self):return self._temp_stringdef commit_short_sentence(self):"""将临时字符串 提交到临时短句"""self._commited_short_sentences.append(self._temp_string)self._temp_string = ""def commit_segment(self):"""将短句 合并 到长句中"""self._commited_segments.append(self.short_sentence)7 unmodified linesself.commit_short_sentence()if is_end_sentence:self.commit_segment()def segement_merge(segments):"""根据标点符号分整句"""sequences = []21 unmodified linesis_end = Falsefor idx, seg in enumerate(segments):left_watch_sequences.append(seg)if seg.text in markers:seg_index = int(seg.t1 / 100 * sample_rate)# rest_buffer_duration = (len(audio_buffer) - seg_index) / sample_rate# is_end = any(i in seg.text for i in config.SENTENCE_END_MARKERS)11 unmodified linesleft_watch_idx = 0is_end = Falsesequences = segement_merge(segments)if len(sequences) > 2:logger.info(f"buffer clip via sequence, current length: {len(sequences)}")is_end = True5 unmodified linesreturn left_watch_idx, left_watch_sequences, right_watch_sequences, is_end19 unmodified lines2021222324252616 unmodified lines434445464748495 unmodified lines555657585960616263646566676869707172737475767778798081827 unmodified lines9091929394959621 unmodified lines11811912012112212312412512611 unmodified lines1381391401411421431445 unmodified lines15015115219 unmodified lines"""self.history.append((text, index))def get_final_index(self, similarity_threshold=0.7):"""根据文本变化,返回可靠的标点的buffer的位置下标"""if len(self.history) < 2:16 unmodified lines@staticmethoddef text_similarity(text1, text2):return SequenceMatcher(None, text1, text2).ratio()class SegmentManager:5 unmodified linesdef handle(self, string):self._temp_string = stringreturn self@propertydef short_sentence(self) -> str:return "".join(self._commited_short_sentences)@propertydef segment(self):return self._commited_segments[-1] if len(self._commited_segments) > 0 else ""def get_seg_id(self):return len(self._commited_segments)@propertydef string(self):return self._temp_stringdef commit_short_sentence(self):"""将临时字符串 提交到临时短句"""self._commited_short_sentences.append(self._temp_string)self._temp_string = ""def commit_segment(self):"""将短句 合并 到长句中"""self._commited_segments.append(self.short_sentence)7 unmodified linesself.commit_short_sentence()if is_end_sentence:self.commit_segment()def segement_merge(segments):"""根据标点符号分整句"""sequences = []21 unmodified linesis_end = Falsefor idx, seg in enumerate(segments):print(">>>>>>>>>>>>>>>>>> seg: ", seg)left_watch_sequences.append(seg)if seg.text and seg.text[-1] in markers:seg_index = int(seg.t1 / 100 * sample_rate)# rest_buffer_duration = (len(audio_buffer) - seg_index) / sample_rate# is_end = any(i in seg.text for i in config.SENTENCE_END_MARKERS)11 unmodified linesleft_watch_idx = 0is_end = Falsesequences = segement_merge(segments)if len(sequences) > 2:logger.info(f"buffer clip via sequence, current length: {len(sequences)}")is_end = True5 unmodified linesreturn left_watch_idx, left_watch_sequences, right_watch_sequences, is_end
config.py+7-3
transcribe/pipelines/pipe_whisper.py+10-2
transcribe/strategy.py+13-13