Honyaku Multi Translator Swallow Ms7b
基于Swallow-MS-7b开发的英日/日英双向翻译模型,专注中长文本翻译,支持部分多语言翻译
Downloads 22
Release Time : 3/30/2024
Model Overview
该模型基于Swallow-MS-7b的日语能力开发,通过8K上下文窗口微调,主要面向100至数千token的中长文本翻译场景。核心优势在于英日互译,但也部分支持其他语种翻译。
Model Features
中长文本翻译优化
专为100token至数千token的中长文本翻译场景优化,支持8K上下文窗口
多语言支持
除核心的英日互译外,还支持意大利语、法语、西班牙语等多种语言的翻译
高效指令理解
采用类XML指令格式,指令token消耗少且模型理解精准
Model Capabilities
英日双向翻译
日英双向翻译
多语言翻译
中长文本处理
Use Cases
翻译服务
学术文献翻译
翻译国际法、经济政策等专业领域的学术文献
保持专业术语准确性,处理复杂句式
商业文件翻译
翻译跨国企业合同、报告等商业文件
确保法律和商业术语的准确转换
多语言内容处理
多语言内容本地化
将内容从英语翻译为日语或其他支持语言
适应不同语言的文化表达习惯
🚀 多语言翻译模型 - Honyaku-7b-v2
本项目是一款基于 Swallow-MS-7b 的翻译模型,主要聚焦于英日互译,同时部分支持多种其他语言的翻译。它经过 8K 上下文的微调,适合处理 100 到数千 token 的较长文本。
🚀 快速开始
2024 年 4 月 8 日,我们上传了一个新模型,增强了多语言支持能力,你可以通过以下链接获取: Honyaku-7b-v2
✨ 主要特性
- 多语言翻译:核心支持英日互译,同时部分支持意大利语、法语、西班牙语等多种语言。
- 长文本处理:经过 8K 上下文微调,适合翻译 100 到数千 token 的相对长文。
- 特定 Prompt 格式:采用 XML 风格的指令模板,减少 token 消耗,提升模型对指令的理解。
📦 安装指南
文档未提及安装步骤,暂不提供。
💻 使用示例
基础用法
英日翻译的 Prompt 格式
<english>: {} </english>
<japanese>: {} </japanese>
日英翻译的 Prompt 格式
<japanese>: {} </japanese>
<english>: {} </english>
高级用法
对于长文翻译,建议使用 TextStreamer
,以下是一个长文英日翻译的示例代码:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model_name = "aixsatoshi/Honyaku-Multi-Translator-Swallow-ms7b"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Define the streamer
streamer = TextStreamer(tokenizer)
# Define the English prompt
english_prompt = """
In an era marked by rapid globalization, the intricate interplay between international law, economic policies, and political dynamics has become increasingly complex.
Legal frameworks, once confined within national borders, now stretch across continents, necessitating a nuanced understanding of transnational legislation and treaties.
As multinational corporations navigate the labyrinthine maze of global markets, economic theories that underpin currency fluctuations, trade imbalances, and fiscal policies are more pertinent than ever.
Central to these economic considerations is the concept of market equilibrium, a delicate balance affected by myriad factors including consumer behavior, governmental regulations, and global crises.
Politically, the landscape is equally labyrinthine. Ideological shifts and the resurgence of nationalism have reshaped diplomatic relations, with international agreements and alliances being tested under the strain of geopolitical tensions.
The role of supranational entities like the United Nations and the European Union in mediating these conflicts is of paramount importance, as is the need for diplomatic finesse in an increasingly multipolar world.
Furthermore, the intersection of politics and economics is evident in the debate over economic sanctions and their efficacy in swaying political decisions.
In this context, understanding the subtleties of rhetoric used in political discourse, and how it interweaves with legal jargon and economic terminology, is crucial.
For instance, the rhetoric surrounding fiscal austerity measures often intertwines with legal discourse on budgetary legislation and economic debates on inflation control.
Similarly, discussions on constitutional amendments are frequently laden with political undertones, reflecting broader societal issues and ideological divides.
This convergence of legal, economic, and political vernacular presents a unique challenge for machine translation systems, demanding not only linguistic accuracy but also a deep comprehension of the nuanced interplay of these disciplines.
"""
# Prepare the prompt for English to Japanese translation
prompt = f"<english>: {english_prompt} </english>\n\n<japanese>:"
# Tokenize the input text and move to CUDA device
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
# Generate the output using the model and streamer
output = model.generate(**inputs, max_new_tokens=4096, do_sample=True, top_k=20, top_p=0.95, streamer=streamer)
多语言翻译示例
以下是不同语言的翻译示例:
>**<english>**:In an era marked by rapid globalization, the intricate interplay between international law, economic policies, and political dynamics has become increasingly complex. Legal frameworks, once confined within national borders, now stretch across continents, necessitating a nuanced understanding of transnational legislation and treaties. As multinational corporations navigate the labyrinthine maze of global markets, economic theories that underpin currency fluctuations, trade imbalances, and fiscal policies are more pertinent than ever. Central to these economic considerations is the concept of market equilibrium, a delicate balance affected by myriad factors including consumer behavior, governmental regulations, and global crises.
>
>Politically, the landscape is equally labyrinthine. Ideological shifts and the resurgence of nationalism have reshaped diplomatic relations, with international agreements and alliances being tested under the strain of geopolitical tensions. The role of supranational entities like the United Nations and the European Union in mediating these conflicts is of paramount importance, as is the need for diplomatic finesse in an increasingly multipolar world. Furthermore, the intersection of politics and economics is evident in the debate over economic sanctions and their efficacy in swaying political decisions.
>
>In this context, understanding the subtleties of rhetoric used in political discourse, and how it interweaves with legal jargon and economic terminology, is crucial. For instance, the rhetoric surrounding fiscal austerity measures often intertwines with legal discourse on budgetary legislation and economic debates on inflation control. Similarly, discussions on constitutional amendments are frequently laden with political undertones, reflecting broader societal issues and ideological divides.
>This convergence of legal, economic, and political vernacular presents a unique challenge for machine translation systems, demanding not only linguistic accuracy but also a deep comprehension of the nuanced interplay of these disciplines.
></english>
>
>**<japanese>**:急速なグローバル化を特徴とする時代において、国際法、経済政策、政治的ダイナミクスの間の複雑な相互作用はますます複雑になっています。かつては国内国境内でのみ適用されていた法的枠組みが今や大陸を超えて広がっており、それらを理解するためには、国境を越えた法律や条約に関する繊細な理解が必要です。多国籍企業が世界市場の迷路をナビゲートしながら、通貨変動、貿易不均衡、財政政策などを裏付ける経済理論は、より重要性を増しています。これらの経済上の考慮事項の中心にあるのは、消費者行動、政府規制、そしてグローバル危機を含むさまざまな要因によって影響を受けるデリケートなバランスである市場平衡の概念です。
>
>政治的に見ても、この地形も同様に複雑です。イデオロギーの変化とナショナリズムの復活により、外交関係が地政学的緊張の下で試練にさらされる中、国際協定や同盟が検査されています。国連や欧州連合などの超国家機関の仲介役としての役割は極めて重要であり、さらに、ますます多極化する世界における外交手腕の必要性も不可欠です。さらに、経済制裁の有効性についての議論の中でも、政治と経済の交差点が明らかです。
>
>この文脈では、政治的討論で使用される口語表現の微妙な違いを理解し、それが法律用語や経済用語とどのように絡み合っているかを理解することが重要です。たとえば、緊縮財政措置にまつわる言説は、予算立法に関する法的議論やインフレ制御に関する経済議論と絡み合う傾向があります。また、憲法改正に関する議論には政治的ニュアンスが含まれていることが多く、社会全体の問題やイデオロギー的対立を反映しています。
>
>このように、法律、経済、政治の言葉が融合した状況に対処するには、機械翻訳システムにとって独自の課題が生じます。言語的正確さだけでなく、これらの分野の微妙な相互作用の深い理解も求められます。<NL>
></japanese>
>
>
>**<french>**:L’ère marquée par le rapide processus de mondialisation se caractérise par un jeu subtil entre la loi internationale, les politiques économiques et les dynamiques politiques qui sont plus complexes que jamais. Les législations nationales désormais s’étendent sur des continents nécessitant une compréhension fine des réglementations transnationaux et des traités internationaux. Dans le contexte des multinationaux qui naviguent dans le labyrinthe du marché mondial, les théories économiques fondées sur les fluctuations monétaires, les équilibres commerciaux et les politiques fiscales sont plus pertinent qu'ever. À leur centre, la notion d’équilibre du marché, affecté par un nombre sans cesse croissant de facteurs, notamment le comportement des consommateurs, les réglementations gouvernementales et les crises mondiales, est centrale.
>
>Politiquement, la paysage est aussi labyrinthique. L’évolution des idées et du renouveau du nationalisme ont modifié les relations diplomatiques, où les accords internationaux et les alliances sont testées sous le poids de tensions géopolitiques. Le rôle des entités supra-nationales telles que l’Organisation des Nations Unies ou de l’Union européenne pour médier ces conflits est de premier plan, comme aussi bien la délicate diplomatie dans un monde devenu plus multipolaire. De plus, les liens de politique avec l’économie sont évidents lorsque la question de l’efficacité des mesures de blocade économique et de leurs impacts sur les décisions politiques est abordée.
>
>Dans ce contexte, comprendre les subtilités du langage utilisé dans le discours politique ainsi que comment il se intègre aux termes juridiques et économiques est essentiel. Par exemple, le langage autour des mesures budgétaires de rigueur se mêle souvent à la discours législatif sur les lois budgétaires et au débat économique sur la lutte contre l’inflation. De même, les discussions sur les amendements constitutionnels sont souvent chargées de tonalité politique, reflétant des problèmes sociétaux plus larges et des divisions idéologiques.
>Cette convergence de langages juridiques, économiques et politiques présente un défaut unique pour les systèmes de traduction machines, demandant non seulement la précision linguistique mais également une profonde compréhension de cette interactivité des disciplines.
></french>
>
>
>**<spanish>**:La era de la globalización rápida ha marcado un cambio complejo en el interplay entre el derecho internacional, políticas económicas y dinámica política. Los marcos legales, una vez contenederos dentro de los límites nacionales, se extienden a través de continent, lo que necesita una comprensión minuciosa de las leyes transnacionales y tratados. En un mundo de empresas multinacionales, la economía está más relevante que nunca, ya que las teorías económicas subyacentes al cambio monetario, desequilibrios comerciales y políticas fiscales son más pertinentes que nunca. A estos aspectos económicos centrales es la idea del equilibrio del mercado, un equilibrio precuoque influenciado por factores tan variados como el comportamiento de los consumidores, reglamentaciones gubernamentales y crisis globales.
>
>Políticamente, la escenografía es igualmente complicada. El cambio de paradigma ideológico y la reactivización del nacionalismo han alterado relaciones diplomáticas internacionales, sometidas al cernido de tensiones geopolíticas. La mediación de estos conflictos por entidades supranacionales como las Naciones Unidas o la Unión Europea es fundamental, así como la necesidad de diplomacia sutil en un mundo cada vez más multipolar. Además, la intersección de política y economía está evidenciada en el debate sobre las sanciones económicas y sus capacidades para dirigir decisiones políticas.
>
>En este contexto, comprender las subtiles de oratoria utilizadas en el discurso político y cómo se interrelaciona con el vocabulario jurídico y el terminología económica es crítico. Por ejemplo, el oratorio sobre medidas fiscales austera les intertwine con el discurso sobre legislación presupuestaria y dilectas sobre inflación controlada. De manera similar, las discusiones sobre modificaciones constitucionales están frecuentemente cargadas de tintes políticas, reflejando problemáticas sociales más amplias y división ideológica.
>Esta convergencia de vocabularios jurídico, económico y político presenta un desafío único para sistemas de traducción automatizada, demandiendo no solo lingüística exactitud, pero también profunda comprensión de los subtelos de interacción de estas disciplinas.
></span>
>
>
>**<Indonesian>**:Era yang dikarakterkan oleh kecepatan globalisasi pembandingan antara negara berlatih, hubungan antara hukum internasional, ekonomi dan politika dinamis menjadi semakin kompleks. Hukuman-hukuman yang sebelumnya terbatas dalam batas nasional saat ini menyajikan hingga kontinen, memerlukan pengecahahan yang diperluaskan tentang peraturan dan persuatan internasional. Pusat usaha multi nasional navigasi kasih meandrean pasar global, teori ekonomi yang berdasarkannya untuk mata angka, imbalance dagangan, dan polisi fiskal lebih penting akhirnya. Tentang ekonomi ini senter ke konsep keadaan rata-rata pasar, diwakilkan oleh berbagai faktor termasuk gerakan pelaku, regulasi negara dan krisis global.
>
>Hidup politik, landskap juga penuh meanderean. Perubahan ideologi dan resurekta Nasionalisme adalah peningkatan hubungan diplomatik, dimana perjanji antar negara dan aliansi internasional di ujuk oleh tegakan geopolitik. Mediasi konflik ini oleh entitas supra nasional seperti PBB dan EUB yang melakukanya penting besar, sama sekali diperlukan kekerjaan kerjasama diplomatika dalam dunia yang semakin polarisasi. Selain itu, masalah politik dan ekonomi disajikan dalam debat mengenai ekonomsan dan kesaktinan ekonomsan dalam menghantarkan keputusan politik.
>
>Dalam context ini, memahami subtilitas bahasa yang digunakan dalam diskursi politik, dan bagaimana ia weave dengan jurileg dan bahasa ekonomi, sangat penting. Misalnya, bahasa yang digunakan kerasa yang bersifat budgetari kerap weave dengan bahasa legalkritik budget dan ekonomi dalam mencoba memelihar konsensus inflasi. Sama sekala, percakapan amandemen constitutions sering diberimbau dengan temuan politis, mereflecting kesulitan umum dan ideologi pemisahan.
>Konvergensi bahasa hukum, ekonomi, dan politik membuat sistem mesin translater paling unik, membutuhkan tidak hanya lingkungan lingual baik tetapi penuh pemahaman nuansa interaksi antara kedua-dua ilmu ini.
></indonesian>
>
📚 详细文档
模型描述
本模型利用了 tokyotech-llm/Swallow-MS-7b-v0.1
的高日语能力,主要用于英日和日英翻译。模型在 8K 上下文下进行了微调,旨在处理 100 到数千 token 的相对长文。同时,它也部分支持多种其他语言的翻译,但多语言翻译功能和长文翻译在量化时可能会变得不稳定。
tokyotech-llm/Swallow-MS-7b-v0.1
Prompt 格式
采用了类似 XML 的指令模板,其优点是减少 Instruction
的 token 消耗,且模型对指令的理解较好;缺点是对带标签的文本处理能力较弱。
多语言支持情况
- 表现较好的语言标签:英语到日语翻译的标签工作正常,其他功能标签如
<english>
、<italian>
、<french>
、<spanish>
、<Portuguese>
、<German>
、<Danish>
、Nederlands
、Czech
等有一定支持,但大多不太稳定。 - 表现不佳的语言:
<Indonesian>
、<Norwegian>
、<Swedish>
、<turkish>
、Русский
、Dutch
、turkish
、Vietnamese
、ελληνική γλώσσα
、Arabic
、Vietnamese
、Tiếng Việt
、မြန်မာဘာသာ
、Filipino
等语言的翻译效果不太好,大多不稳定。 - 几乎无法工作的语言:
Finnish
、Hindi
、తెలుగు
、አማርኛ
、ພາສາລາວ
等语言的翻译几乎无法正常工作。
🔧 技术细节
模型局限性
- 短文本和超长文本:在短文本或非常长的文章中,可能会出现
stoptoken
不稳定和重复翻译的问题。 - 长文性能:当翻译超过 4000 token 的文本时,会出现明显的性能下降,如跳读等情况。
- 概念理解:对于模型无法理解的概念,容易出现幻觉现象。
未来计划
由于支持多种语言翻译,部分语言的翻译精度有所牺牲,后续将继续训练更准确的模型。
📄 许可证
本项目采用 Apache-2.0
许可证。
⚠️ 重要提示
模型在短文本、超长文本以及处理无法理解的概念时存在局限性,请自行承担输出内容的使用风险。
💡 使用建议
对于长文翻译,建议使用
TextStreamer
以提升翻译体验。
M2m100 418M
MIT
M2M100是一个多语言编码器-解码器模型,支持100种语言的9900个翻译方向
机器翻译 Supports Multiple Languages
M
facebook
1.6M
299
Opus Mt Fr En
Apache-2.0
基于Transformer的法语到英语神经机器翻译模型,由Helsinki-NLP团队开发,采用OPUS多语数据集训练。
机器翻译 Supports Multiple Languages
O
Helsinki-NLP
1.2M
44
Opus Mt Ar En
Apache-2.0
基于OPUS数据训练的阿拉伯语到英语的机器翻译模型,采用transformer-align架构
机器翻译 Supports Multiple Languages
O
Helsinki-NLP
579.41k
42
M2m100 1.2B
MIT
M2M100是一个支持100种语言的多语言机器翻译模型,可直接在9900个翻译方向之间进行翻译。
机器翻译 Supports Multiple Languages
M
facebook
501.82k
167
Indictrans2 Indic En 1B
MIT
支持25种印度语言与英语互译的1.1B参数规模机器翻译模型,由AI4Bharat项目开发
机器翻译
Transformers Supports Multiple Languages

I
ai4bharat
473.63k
14
Opus Mt En Zh
Apache-2.0
基于Transformer架构的英汉多方言翻译模型,支持英语到13种汉语变体的翻译任务
机器翻译 Supports Multiple Languages
O
Helsinki-NLP
442.08k
367
Opus Mt Zh En
由赫尔辛基大学开发的基于OPUS语料库的中文到英语机器翻译模型
机器翻译 Supports Multiple Languages
O
Helsinki-NLP
441.24k
505
Mbart Large 50 Many To Many Mmt
基于mBART-large-50微调的多语言机器翻译模型,支持50种语言间的互译
机器翻译 Supports Multiple Languages
M
facebook
404.66k
357
Opus Mt De En
Apache-2.0
opus-mt-de-en 是一个基于 transformer-align 架构的德语到英语的机器翻译模型,由 Helsinki-NLP 团队开发。
机器翻译 Supports Multiple Languages
O
Helsinki-NLP
404.33k
44
Opus Mt Es En
Apache-2.0
这是一个基于Transformer架构的西班牙语到英语的机器翻译模型,由Helsinki-NLP团队开发。
机器翻译
Transformers Supports Multiple Languages

O
Helsinki-NLP
385.40k
71
Featured Recommended AI Models
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers Supports Multiple Languages

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers English

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 Chinese
R
uer
2,694
98