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
File size: 4,471 Bytes
90a29dd 138d976 90a29dd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | <!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>试试翻译</title>
<style>
body {
background-color: #f9f9fc;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
margin: 0;
padding: 2rem;
}
.translation-box {
background: #f2f2f8;
border-radius: 12px;
padding: 1.5rem;
max-width: 800px;
margin: 0 auto;
min-height: 200px;
}
.entry {
margin-bottom: 1.5rem;
}
.timestamp {
font-size: 0.75rem;
color: #999;
}
.original {
font-size: 1rem;
color: #333;
}
.translation {
font-size: 1rem;
font-weight: bold;
color: #000;
}
.footer {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 2rem;
}
.lang-select {
background: white;
border-radius: 9999px;
padding: 0.4rem 1rem;
border: none;
font-size: 1rem;
box-shadow: 0 0 0 1px #ddd;
}
.record-button {
background-color: #1e40af;
color: white;
border: none;
padding: 0.6rem 1.2rem;
border-radius: 9999px;
font-size: 1rem;
cursor: pointer;
}
</style>
</head>
<body>
<div class="translation-box" id="translationBox">
<!-- 实时内容将插入这里 -->
</div>
<div class="footer">
<select class="lang-select">
<option>中文 » 英语</option>
</select>
<button class="record-button" onclick="startRecording()">🎤 录音</button>
</div>
<script>
let ws;
let mediaRecorder;
function formatTimestamp(ms) {
const sec = ms / 1000;
const min = Math.floor(sec / 60);
const s = (sec % 60).toFixed(1);
return `${String(min).padStart(2, '0')}:${s.padStart(4, '0')}`;
}
let lastSegId = null; // 用于存储上一个 seg_id
function addTranslation(result) {
const box = document.getElementById('translationBox');
// 创建一个新的 div 来显示翻译
const entry = document.createElement('div');
entry.className = 'entry';
console.log(result);
const start = formatTimestamp(result.bg);
const end = formatTimestamp(result.ed);
// 判断是否是新的一行
if (result.seg_id === lastSegId) {
// 如果 seg_id 相同,更新该行内容
const existingEntry = box.querySelector(`.entry[data-seg-id="${result.seg_id}"]`);
if (existingEntry) {
const translationDiv = existingEntry.querySelector('.translation');
translationDiv.innerHTML = result.tranContent;
}
} else {
// 如果 seg_id 不同,表示是新的行,添加新行
entry.setAttribute('data-seg-id', result.seg_id); // 设置 seg_id
entry.innerHTML = `
<div class="original">${result.context}</div>
<div class="translation">${result.tranContent}</div>
`;
box.appendChild(entry);
}
// 更新 lastSegId 以便下一次判断
lastSegId = result.seg_id;
}
async function startRecording() {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const audioContext = new AudioContext({ sampleRate: 16000 });
const source = audioContext.createMediaStreamSource(stream);
const processor = audioContext.createScriptProcessor(4096, 1, 1);
const wsUrl = "ws://localhost:9191/ws?from=zh&to=en";
ws = new WebSocket(wsUrl);
ws.binaryType = "arraybuffer";
ws.onopen = () => {
console.log("WebSocket opened");
source.connect(processor);
processor.connect(audioContext.destination);
processor.onaudioprocess = (e) => {
const input = e.inputBuffer.getChannelData(0);
const buffer = new Int16Array(input.length);
for (let i = 0; i < input.length; i++) {
buffer[i] = Math.max(-1, Math.min(1, input[i])) * 0x7FFF;
}
ws.send(buffer);
};
};
ws.onmessage = (event) => {
try {
const msg = JSON.parse(event.data);
if (msg.result) {
addTranslation(msg.result);
}
} catch (e) {
console.error("Parse error:", e);
}
};
ws.onerror = (e) => console.error("WebSocket error:", e);
ws.onclose = () => {
console.log("WebSocket closed");
processor.disconnect();
source.disconnect();
};
}
</script>
</body>
</html>
|