#5354 用本地API引擎翻译 和 Simplified Chinese反复出现在翻译正文中,如何解决。

2408:8362* Posted at: 2 days ago

用本地API引擎翻译 和 Simplified Chinese反复出现在翻译正文中,如何解决。

6 Replies

根据你的描述,翻译结果中出现 <TRANSLATE_TEXT>和 Simplified Chinese 这类占位符或提示词文本,通常是翻译渠道的提示词(Prompt)被模型错误地输出,或者模板变量未被正确替换导致的。

解决方案

  1. 取消勾选“发送完整字幕”
    在翻译设置中,关闭“发送完整字幕”选项。这会让软件按纯文本逐行提交翻译,而非携带时间轴的完整 SRT 格式,可避免因提示词排版错误引发的模型乱输出。
  2. 检查自定义提示词文件
    如果你曾修改过提示词,请打开软件目录下的 videotrans/prompts/srt/videotrans/prompts/text/ 文件夹,确认里面没有误写入的 <TRANSLATE_TEXT>Simplified Chinese 等固定文本。恢复为默认提示词即可。
  3. 更换翻译模型或渠道
    如果使用的是本地部署的小模型(如 7B 级参数),其指令跟随能力较弱,容易输出无关文本。建议换用官方在线 AI 渠道(如 DeepSeek、OpenAI)并搭配旗舰模型,或确保本地模型支持翻译指令。
  4. 清理翻译缓存
    进入软件目录下的 tmp/translate_cache/ 文件夹,清空所有缓存文件,重新执行任务,避免旧缓存干扰。

若以上仍无法解决,请提供 logs/ 目录下最新的日志文件(约底部 30 行),以便进一步定位。

根据使用的渠道,自行精简提示词,如果你使用的是 兼容AI/本地模型,对应提示词在软件目录/videotrans/prompts/srt/localllm.txt软件目录/videotrans/prompts/text/localllm.txt中,前者是选中发送完整字幕时使用的,后者是未选中时使用的,打开txt,精简后修改,本地小模型可能难以理解和遵守复杂提示词,可让AI帮你精简,注意{}包裹的是变量,不要修改不要删除

[DEBUG] 开始语音识别:渠道0
[DEBUG] app_cfg.proxy=None
[DEBUG] 无法连接 huggingface.co, 使用镜像替换: hf-mirror.com
[DEBUG] 从 modelscope.cn 下载模型 model_id='base.en'
2026-06-22 00:15:53,601 - modelscope - WARNING - We can not confirm the cached file is for revision: master
[DEBUG] [新进程任务 开始:STT use base.en]
[DEBUG] 任务参数:kwargs={'detect_language': 'en', 'model_name': 'base.en', 'logs_file': 'C:/Users/Administrator/Desktop/pyvideotrans/tmp/9576/c5b50189b8/faster-en-1782058553.6019948.log', 'is_cuda': True, 'no_speech_threshold': 0.7, 'condition_on_previous_text': False, 'speech_timestamps': None, 'audio_file': 'C:/Users/Administrator/Desktop/pyvideotrans/tmp/9576/c5b50189b8/en.wav', 'local_dir': 'C:/Users/Administrator/Desktop/pyvideotrans/models/models--Systran--faster-whisper-base.en', 'compute_type': 'float16', 'jianfan': False, 'audio_duration': 1097963, 'hotwords': '', 'prompt': '', 'beam_size': 1, 'best_of': 1, 'temperature': '', 'repetition_penalty': 1.0, 'compression_ratio_threshold': 2.4, 'max_speech_ms': 5000, 'subtitle_srt': 'C:/Users/Administrator/Desktop/pyvideotrans/tmp/faster-20260622-00_15_53.srt', 'device_index': 0}
[DEBUG] [新进程任务 STT use base.en], return
[DEBUG] [新进程任务 结束:STT use base.en],耗时37.335755825042725s
[DEBUG] 开始移除每条字幕末尾标点

[DEBUG] 新进程执行结束结束timeout=0
[DEBUG] 开始字幕翻译: 渠道8
[DEBUG] 行数不匹配,原始:10, 结果:9
it=["Let's get this show on the road man 2079", "We're playing a 2021", "Okay, let's do a", "Let's do a nimzo slash Queen's Indian height. That's not something that we have played", "Often but it is my second opening after the King's Indian", 'Okay, Bishop D2 so Bishop D2', 'Okay, Bishop D2 is a move', "It's not considered theoretically topical", "It's quite passive", "but it's been gaining some popularity actually recently"]
sep_res=['让我们推动这件事前进,伙计 2079年', '我们在玩2021年的棋局', '好,我们来做一个尼姆佐变后翼印度防御。这不是我们经常玩的棋局', '但它是继王翼印度防御之后的第二个开局', '好,象D2所以象D2', '好,象D2是一个步数', '理论上并不热门', '相当被动', '但实际上最近越来越流行了']
[DEBUG] 行数不匹配,原始:10, 结果:9
it=['You play B6, B7', 'and then D6', 'Night BD7', 'So you create these little holes for your pieces', 'and that is considered one of the most solid setups available in the Nimzo Indian', 'So the move D5 here would be fine, but not really', 'in the spirit of the Nimzo Indian', "Indian. So we are going to play this in the spirit in the names of Indian. We're going", 'to play D six and night, Bd seven', 'And this is a very, very common and very solid setup']
sep_res=['D6 ', '夜間 BD7 ', '所以你為你的兵創造了這些小空間 ', '這被視為尼姆佐印度防御中最堅固的佈局之一 ', '因此,此處的D5步並不恰當 ', '不符合尼姆佐印度防御的精神 ', '我們將依照尼姆佐印度防御的原則進行對弈 ', '我們會在夜晚的D6和BD7位置進行對戰 ', '這是一種非常常見且堅固的佈局']
[DEBUG] 行数不匹配,原始:10, 结果:5
it=['because there are no weaknesses. You know, now we have to continue improving our position', 'We positioned our pieces on the squares we were supposed to position them. And now there', 'are a couple of subsequent follow up plans', 'So one of them is to play something like Queen', 'to E7 and then push E65', 'But a more aggressive idea that I really like involves playing them', 'of Knight to E4, which is a pretty natural move, and then following up with F5. I mean', "this is an idea that you should be very familiar with if you're over 1500, for example, 94", 'and F5', 'This is a ubiquitous idea across many different openings. Rook 8 to D1']
sep_res=['因为没有任何弱点。你知道的,现在我们必须继续改善我们的局面。', '我们将棋子摆在了应该放置它们的格子上。现在有一些后续的计划。', '其中之一是走皇后到E7然后推E65。', '但我非常喜欢的一个更激进的想法是让他们吃马到E4,这是一个很自然的步法,然后接着走F5。我的意思是,如果你超过1500分,比如94分,这个想法你应该非常熟悉,F5。', '这是许多不同开局中常见的想法。车8到D1。']
[DEBUG] 行数不匹配,原始:10, 结果:2
it=['Now, of course, we have the option of eliminating of', "subtracting White's Bishop from the board", 'One way we could play this is to take the bishop and then actually get the', 'other knight around to E4', 'Another pretty classic concept', "I don't feel strongly about that one way or the other", 'The bishop on C3 does have a pretty bright future', 'especially if White pushes D5 at some point', 'So it might be worth taking that bishop off the board, even though our knight on E4', 'is a strong piece']
sep_res=['', '当然,我们现在可以选择将白方的象从棋盘上移除。一种策略是拿下这个象,然后让另一个骑士移动到E4位置。这是非常经典的一种战术。我对这种方法的看法并不坚定。C3上的象未来相当光明,特别是如果白方在某个时候推进到D5的话。因此,即使我们的E4骑士很强,也值得将那个象从棋盘上移除。']

你的问题是由于使用了本地小模型(如兼容AI/本地模型渠道),其指令跟随能力较弱,导致模型将提示词中的 {target_language} 或类似变量输出成了 "Simplified Chinese",或将系统提示词原文带入了翻译正文。

解决方法:

  1. 找到并精简提示词文件
    打开软件目录下的以下两个文本文件:

    • videotrans/prompts/srt/localllm.txt(如果勾选了“发送完整字幕”)
    • videotrans/prompts/text/localllm.txt(如果未勾选“发送完整字幕”)
  2. 精简内容
    本地小模型难以理解复杂指令,请将文件内容大幅精简,只保留最核心的关键词,例如:

    将以下文本从{}翻译为{},只返回翻译结果

    注意:文件中用 {} 包裹的变量(如 {source_language}{target_language}不要删除或修改,否则翻译会失效。

  3. 恢复默认或让 AI 辅助精简
    如果你不确定如何精简,可让 ChatGPT 等 AI 帮你把原提示词压缩成简单明了的版本,同时保证保留变量。
  4. 清理缓存后重试
    修改后关闭软件,删除 tmp/translate_cache/ 目录下的缓存文件,重新启动执行任务。

如果还有其他问题,请提供修改后的提示词内容及最新日志。

换MT2-7B还是这样

直接将提示词精简为最简形式,去掉所有上下文和引导词。例如在 videotrans/prompts/text/localllm.txt 中仅保留:

把以下{source_language}翻译为{target_language},只输出翻译结果。

对应的 srt/localllm.txt(若使用发送完整字幕)则改为:

把以下SRT字幕中的文本从{source_language}翻译为{target_language},保留原时间轴和行号,只输出SRT格式内容。

修改后清空 tmp/translate_cache/ 下的缓存文件,重启软件重试。

如果问题依旧,说明 MT2-7B 的指令遵循能力不足以处理这种带变量的提示,请切换到其他在线 AI 渠道(如 DeepSeek、OpenAI),或改用更大参数的本地模型(12B 以上)。

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update. Dondate: ko-fi.com/jianchang512

Related resource