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
- 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
daihui.zhang commited on
Commit ·
9522b50
1
Parent(s): 1c053c4
update prompt keywords
Browse files- config/hotwords.json +6 -1
- config/keyword_list.txt +0 -0
- config/keywords.txt +4 -0
- config/prompt.py +4 -13
- config/settings.py +2 -2
config/hotwords.json
CHANGED
|
@@ -3,5 +3,10 @@
|
|
| 3 |
"GO SIM": "GOSIM",
|
| 4 |
"go sim": "GOSIM",
|
| 5 |
"GO SAME": "GOSIM",
|
| 6 |
-
"go same": "GOSIM"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
}
|
|
|
|
| 3 |
"GO SIM": "GOSIM",
|
| 4 |
"go sim": "GOSIM",
|
| 5 |
"GO SAME": "GOSIM",
|
| 6 |
+
"go same": "GOSIM",
|
| 7 |
+
"GoSync": "GOSIM",
|
| 8 |
+
"CSN": "CSDN",
|
| 9 |
+
"CSDF": "CSDN",
|
| 10 |
+
"CSTN": "CSDN",
|
| 11 |
+
"OpenAZI": "Open AGI"
|
| 12 |
}
|
config/keyword_list.txt
DELETED
|
File without changes
|
config/keywords.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
OpenAGI
|
| 2 |
+
GOSIM
|
| 3 |
+
Rust
|
| 4 |
+
LLaMA Factory
|
config/prompt.py
CHANGED
|
@@ -13,24 +13,16 @@ hotwords_file = CONFIG_DIR / 'hotwords.txt'
|
|
| 13 |
hotwords_json = json.loads((CONFIG_DIR / 'hotwords.json').read_text())
|
| 14 |
|
| 15 |
# 翻译提示词
|
| 16 |
-
keywords_list = [
|
| 17 |
-
|
| 18 |
-
"GO SIM",
|
| 19 |
-
'Rust',
|
| 20 |
-
]
|
| 21 |
-
keywords_mapping_string = '\n'.join([
|
| 22 |
-
f' * {value}'
|
| 23 |
-
for value in keywords_list
|
| 24 |
-
])
|
| 25 |
|
| 26 |
LLM_SYS_7B_PROMPT_EN = """
|
| 27 |
-
你是一
|
| 28 |
|
| 29 |
规则:
|
| 30 |
- 翻译时要准确传达原文的事实和背景;
|
| 31 |
- 即使上意译也要保留原始段落格式,以及保留术语,例如 FLAC,JPEG 等。保留公司缩写,例如 Microsoft, Amazon, OpenAI 等;
|
| 32 |
- 人物的名称不需要翻译;
|
| 33 |
-
- 全角括号换成半角括号,并在左括号前面加半角空格,右括号后面加半角空格;
|
| 34 |
- 在翻译专业术语时,第一次出现时要在括号里面写上英文原文,例如:“生成式 AI (Generative AI)”,之后就可以只写中文了;
|
| 35 |
- 以下是常见的AI相关术语,这部分的术语不需要翻译;
|
| 36 |
|
|
@@ -40,14 +32,13 @@ LLM_SYS_7B_PROMPT_EN = """
|
|
| 40 |
""".format(keywords_mapping_string=keywords_mapping_string)
|
| 41 |
|
| 42 |
LLM_SYS_7B_PROMPT_ZH = """
|
| 43 |
-
你是一个
|
| 44 |
翻译规则:
|
| 45 |
1. 保留以下内容的原始英文形式,不翻译:
|
| 46 |
- 技术术语和专业词汇
|
| 47 |
- 产品名称、品牌名称
|
| 48 |
- 代码片段、函数名、变量名
|
| 49 |
- 专有名词、缩写和首字母缩略词
|
| 50 |
-
- 网址、路径和文件名
|
| 51 |
2. 翻译其余内容时,请确保:
|
| 52 |
- 保持原文的段落结构
|
| 53 |
- 翻译内容符合中文表达习惯
|
|
|
|
| 13 |
hotwords_json = json.loads((CONFIG_DIR / 'hotwords.json').read_text())
|
| 14 |
|
| 15 |
# 翻译提示词
|
| 16 |
+
keywords_list = [i.strip() for i in (CONFIG_DIR / 'keywords.txt').read_text().split('\n') if i.strip()]
|
| 17 |
+
keywords_mapping_string = '\n'.join([f' * {value}' for value in keywords_list ])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
LLM_SYS_7B_PROMPT_EN = """
|
| 20 |
+
你是一个英中文翻译专家,尤其擅长将专业学术语言翻译成浅显易懂的口语。请你帮我将以下英文段落翻译成中文,风格与中文科普读物相似。
|
| 21 |
|
| 22 |
规则:
|
| 23 |
- 翻译时要准确传达原文的事实和背景;
|
| 24 |
- 即使上意译也要保留原始段落格式,以及保留术语,例如 FLAC,JPEG 等。保留公司缩写,例如 Microsoft, Amazon, OpenAI 等;
|
| 25 |
- 人物的名称不需要翻译;
|
|
|
|
| 26 |
- 在翻译专业术语时,第一次出现时要在括号里面写上英文原文,例如:“生成式 AI (Generative AI)”,之后就可以只写中文了;
|
| 27 |
- 以下是常见的AI相关术语,这部分的术语不需要翻译;
|
| 28 |
|
|
|
|
| 32 |
""".format(keywords_mapping_string=keywords_mapping_string)
|
| 33 |
|
| 34 |
LLM_SYS_7B_PROMPT_ZH = """
|
| 35 |
+
你是一个中英文翻译专家,请将以下文本从中文翻译成英文,但保留所有英文专业术语、产品名称、代码片段和专有名词的原始英文形式。遇到英文专业术语或需要保留的内容时,请使用原始英文表达,不要翻译。
|
| 36 |
翻译规则:
|
| 37 |
1. 保留以下内容的原始英文形式,不翻译:
|
| 38 |
- 技术术语和专业词汇
|
| 39 |
- 产品名称、品牌名称
|
| 40 |
- 代码片段、函数名、变量名
|
| 41 |
- 专有名词、缩写和首字母缩略词
|
|
|
|
| 42 |
2. 翻译其余内容时,请确保:
|
| 43 |
- 保持原文的段落结构
|
| 44 |
- 翻译内容符合中文表达习惯
|
config/settings.py
CHANGED
|
@@ -13,9 +13,9 @@ logging.basicConfig(
|
|
| 13 |
filename='translator.log',
|
| 14 |
datefmt="%H:%M:%S"
|
| 15 |
)
|
| 16 |
-
|
| 17 |
SAVE_DATA_SAVE = False
|
| 18 |
-
|
| 19 |
console_handler = logging.StreamHandler()
|
| 20 |
console_handler.setLevel(LOG_LEVEL)
|
| 21 |
console_formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
|
|
|
|
| 13 |
filename='translator.log',
|
| 14 |
datefmt="%H:%M:%S"
|
| 15 |
)
|
| 16 |
+
|
| 17 |
SAVE_DATA_SAVE = False
|
| 18 |
+
|
| 19 |
console_handler = logging.StreamHandler()
|
| 20 |
console_handler.setLevel(LOG_LEVEL)
|
| 21 |
console_formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
|