Skip to content

支持推理模型进行翻译 #650

Description

@highkay

在什么场景下,需要你请求的功能?

推理模型的翻译质量比原版要高不少

解决方案

主要是groq提供了免费的蒸馏过的推理模型,主要是deepseek-r1-distill-qwen-32b。

我正在开发此功能,代码如下

# 过滤掉<think>标签内的内容
if "<think>" in content and "</think>" in content:
    content = re.sub(r"<think>.*?</think>", "", content, flags=re.DOTALL)

我添加到了OpenAITranslator的do_translate方法内,然后本地用python pdf2zh.pdf2zh -i -d运行的,问题是没有生效,翻译的内容还是包含了标签,我单独写了一个unittest,跑起来是没问题的,标签被删掉了。

请帮我看一下,解决之后我会发pr的。

其他内容

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions