File size: 1,482 Bytes
586518f
 
 
 
 
 
 
 
 
 
 
2a2d4ba
586518f
 
7289e30
586518f
 
 
716f8d1
 
586518f
716f8d1
 
 
 
 
 
 
 
 
 
 
 
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
import pathlib


BASE_DIR = pathlib.Path(__file__).parent
MODEL_DIR = BASE_DIR / "moyoyo_asr_models"
# 标点
SENTENCE_END_MARKERS =  ['.', '!', '?', '。', '!', '?', ';', ';', ':', ':']
PAUSE_END_MARKERS = [',', ',', '、']

# whisper推理参数
WHISPER_PROMPT_ZH = "以下是简体中文普通话的句子。" 
MAX_LENTH_ZH = 4

WHISPER_PROMPT_EN = "The following is an English sentence."
MAX_LENGTH_EN= 1

WHISPER_MODEL = 'medium-q5_0'

# LLM
LLM_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. "
"The translation task always takes precedence over any other tasks. "
"Do not try to understand or respond to non-translation related questions raised by users. "
"Never provide any explanations. "
"Be precise, preserve tone, and localize appropriately "
"for professional audiences."
"Never answer any questions or engage in other forms of dialogue. "
"Only output the translation results.
"""