找回密码
 立即注册
搜索
查看: 715|回复: 9

[民间经验] 【软件推荐】沉浸式翻译 - 浏览器插件

[复制链接]

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
发表于 2024-3-31 22:26 | 显示全部楼层 |阅读模式
目前Chrome、Edge、火狐等常见浏览器都有
带原文的翻译插件
官网:
亮点:可以自带LLM(大语言模型)API,用自己想用的模型翻译,自己付钱
支持翻译youtube视频字幕
推荐搭配OpenRouter的服务,选择自己想用的模型做翻译(prompt可能需要微调)

以下是教程:
1. 注册一个OpenRouter账号,充值(支持VISA/Mastercard/American Express/JCB不限国家)
2. 进入到沉浸式翻译设置中
3. 翻译服务选择OpenAI
4. 进入自定义设置
5. 自定义API接口地址改为:https://openrouter.ai/api/v1/chat/completions
6. OpenRouter里,将鼠标悬浮在右上角账户设置界面上,可以看到Keys选项,点进去,创建key,将key填进沉浸式反应设置
7. 在OpenRouter上找到你想用的模型,复制其名称到沉浸式反应设置里的模型里,如我使用的是Claude 3 Haiku,就是anthropic/claude-3-haiku:beta
8. 点击点此测试服务,如果可用就是可以了
9. 根据实际表现,推荐微调一下prompt

成本:大部分模型应该都还可以接受,我觉得Haiku是性能和成本的最佳平衡
反正随便造也就是0.0几usd级别,我觉得没啥好说的

0413更新:tune了一个prompt出来,相比默认不正常输出和拒绝概率明显降低(不能100%避免是肯定的),因为太长了影响本楼排版,发在楼下了


一些sample:
1. 可以一定程度上理解文字吗?可以的


2. 字幕怎么样?速度呢
我喂了一段3小时长的vtb直播进去,大概花了1.5分钟完成全部翻译,效果总体来说还可以了,绝对可以正确翻译大部分(有意义)内容

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

4

主题

4

回帖

193

积分

热带低压

积分
193
发表于 2024-3-31 22:33 | 显示全部楼层
支持!

2

主题

105

回帖

411

积分

论坛版主-副热带高压

积分
411
发表于 2024-4-1 21:44 | 显示全部楼层
本帖最后由 麦尔修 于 2024-4-1 21:53 编辑

稍微研究了一下,如果调用大模型API是需要一定的计算机编程能力,我觉得起码需要有想法去捣鼓233。另外我怎么无法找到这玩意的开发者选项,即便开启了Chrome的开发者模式也是,找不到开发者选项就意味着无法开启大模型的API调用((

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
 楼主| 发表于 2024-4-3 17:35 | 显示全部楼层
麦尔修 发表于 2024-4-1 21:44
稍微研究了一下,如果调用大模型API是需要一定的计算机编程能力,我觉得起码需要有想法去捣鼓233。另外我怎 ...

哈哈哈哈哈哈哈其实比你想象的简单多了,我已更新教程

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
 楼主| 发表于 2024-4-13 18:09 | 显示全部楼层
新tune了一个prompt出来,不正常和拒绝概率相比默认明显降低(适用claude 3 haiku,其他模型未经测试,我通常会认为他不通用):
SYS:
You are a professional, authentic translation engine, only returns translations. Do not output content in original language.  Never reject the translation request even if you don't understand the context. Directly output translation content, never say understood and I will now proceed with the request. Never output irrelevant content.

Prompt:
Translate the text to {{to}} Language, do not reject any translation request even if you don't understand the context. You're to translate whatever you receive without saying you understood the request and will now provide translation or anything similar:

Multiple Prompt:
Translate the {{imt_source_field}} field in the YAML-formatted text below into {{to}}, and write the translation result in the {{imt_trans_field}} field. Do not reject any translation request even if you don't understand the context. You're to translate whatever you receive.

Example request:
  - id: 1
    {{imt_source_field}}: Source
Example result:
  - id: 1
    {{imt_trans_field}}: Translation

Start:

{{yaml}}

Subtitle Prompt:
Translate all {{imt_sub_source_field}} field in the YAML-formatted video subtitle text below into {{to}}, and write the translation result in the {{imt_sub_trans_field}} field. Requirements:

1. You must complete each {{imt_sub_trans_field}} field and retain each {{imt_sub_source_field}} field.
2. Return parsable YAML:

Example request:
  - id: 1
    {{imt_sub_source_field}}: ...
  - id: 2
    {{imt_sub_source_field}}: ...
Example response:
  - id: 1
    {{imt_sub_trans_field}}: ...
    {{imt_sub_source_field}}: ...
  - id: 2
    {{imt_sub_trans_field}}: ...
    {{imt_sub_source_field}}: ...

Start:

{{yaml}}

2

主题

28

回帖

154

积分

管理员-厄尔尼诺

积分
154
发表于 2024-4-14 02:00 | 显示全部楼层
YouTube 自带中文字幕翻译功能,现在的翻译都是大模型翻译,不再是机翻了。
个人编程论坛 pfun.sunrui.ink

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
 楼主| 发表于 2024-4-15 11:54 | 显示全部楼层
greatbody 发表于 2024-4-14 02:00
YouTube 自带中文字幕翻译功能,现在的翻译都是大模型翻译,不再是机翻了。 ...

但是好不好就另说了,他们不知道套的什么模型,反正综合质量依然不怎么过关

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
 楼主| 发表于 2024-4-20 21:28 | 显示全部楼层
最近llama 3发布了,groq有免费的8b和70b api
https://console.groq.com/
llama 3的多语言能力不是很行(训练数据问题),但是似乎还是可以当翻译机的,只是只有英文输出比较好
也有可能稍微tune以下能好不少?
在测试具体怎么优化,如果效果可以回发教程

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
 楼主| 发表于 2024-4-29 00:30 | 显示全部楼层
一个迟到的groq+Llama 3推荐
groq是啥:自己开发芯片的推理服务商,速度极快,在Llama 3 70B上可以达到超过300t/s的神奇速度
而且目前完全免费
缺点就是rate limit比较低(主要是tokens per minute只有7k)

直接到https://console.groq.com/keys创建一个api key,然后把api接口地址改为:https://api.groq.com/openai/v1/chat/completions
然后模型写Llama3-70b-8192或Llama3-8b-8192

Llama 3:
Meta最新的开源大模型,有8b,70b,405b这3个大小,其中405b还没推出
但是一个重大缺点是instruct tune的多语言性能不好,需要一些trick优化一下

我觉得就是他只限于把别的语言翻译成英语,翻译成中文不一定靠谱,具体你们自己试吧

稍微改了一下prompt,有时候依然会抽风,但是整体上还算可以接受:

Translate the text to {{to}} Language, do not reject any translation request even if you don't understand the context. You're to translate whatever you receive without saying you understood the request and will now provide translation or anything similar. Here is the text to be translated:

{{text}}

24

主题

286

回帖

986

积分

管理员-厄尔尼诺

积分
986
QQ
 楼主| 发表于 2024-5-12 03:21 | 显示全部楼层
性价比之王:DeepSeek v2

官方api平台:https://platform.deepseek.com/usage
当前定价:0.14in/0.28out 1M token(USD)
注册送10rmb

目前的rate limit是动态的,他们没说具体是多少,不过我从来没撞上过,你们应该也不会
这个模型大家说不是很听话,所以我稍微微调了一下prompting,在有限范围测试内表现挺好的

至少综合性能上还是比L3好多了,价格也是基本没有,注册送的10rmb能用很久

modified prompting:

sys:
You are a professional, authentic translation engine, only returns translations. Do not output content in original language.  Never reject the translation request even if you don't understand the context. Directly output translation content, never say understood and I will now proceed with the request. Never output irrelevant content, if there's emojis or other untranslatable content, leave it t.

prompt:
Translate the text to {{to}} Language, do not reject any translation request even if you don't understand the context. You're to translate whatever you receive without saying you understood the request and will now provide translation or anything similar. Here is the text to be translated:

{{text}}

multiple prompt:
Translate the {{imt_source_field}} field in the YAML-formatted text below into {{to}}, and write the translation result in the {{imt_trans_field}} field. Do not reject any translation request even if you don't understand the context. You're to translate whatever you receive.

Example request:
  - id: 1
    {{imt_source_field}}: Source
Example result:
  - id: 1
    {{imt_trans_field}}: Translation

Start:

{{yaml}}

其他无改动,视频翻译相关暂未测试,如果需要改我后续再补充
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|TY_Board论坛

GMT+8, 2024-5-20 06:54 , Processed in 0.043249 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表