Edit model card

Update Information

On April 8, 2024, we uploaded a new model with improved multilingual support below:
Honyaku-7b-v2

Description

This is a translation model utilizing the high Japanese proficiency of Swallow-MS-7b, primarily focused on English-Japanese and Japanese-English translation.

The model, tokyotech-llm/Swallow-MS-7b-v0.1, has been fine-tuned with an 8K context and is mainly aimed at translating relatively long texts ranging from 100 to several thousand tokens.

While its core strength lies in English-Japanese and Japanese-English translation, it also partially supports translation in multiple other languages.
(Multilingual translation features and long context translation become unstable when quantized.)

Prompt

An XML-like instruction template has been adopted.


概要

Swallow-MS-7bの高い日本語力を利用した翻訳モデルです
tokyotech-llm/Swallow-MS-7b-v0.1

英日翻訳メインに、8K contextでファインチューニングしています
100 token〜数千tokenまでの比較的長文の翻訳を主目的としています

多言語の翻訳も一部対応しています(多言語翻訳機能や長文翻訳は量子化するとさらに不安定です)

プロンプト

XML likeなinstructionフォーマットを採用しました

  • 利点
    • Instructionのtoken消費少ない
    • モデルの指示理解がよい
  • 欠点
    • タグ付きテキスト処理に弱い

Usage

Prompt format:English to Japanese


<english>: {} </english>

<japanese>: {} </japanese>

Prompt format:Japanese to English


<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)

Multi Language

TAG work in English-to-Japanese
Other functional Tags
<english>:
<italian>:
<french>:
<spanish>:
<Portuguese>:
<German>:
<Danish>:
Nederlands:
Czech :

Not so good ,mostly unstable
<Indonesian>:
<Norwegian>:
<Swedish>:
<turkish>:
Русский:
Dutch:
turkish:
Vietnamese:
ελληνική γλώσσα:
Arabic:
Vietnamese:
Tiếng Việt:
မြန်မာဘာသာ:
Filipino:

Almost not working
Finnish:
Hindi:
తెలుగు:
አማርኛ:
ພາສາລາວ:

Example:

<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>:急速なグローバル化を特徴とする時代において、国際法、経済政策、政治的ダイナミクスの間の複雑な相互作用はますます複雑になっています。かつては国内国境内でのみ適用されていた法的枠組みが今や大陸を超えて広がっており、それらを理解するためには、国境を越えた法律や条約に関する繊細な理解が必要です。多国籍企業が世界市場の迷路をナビゲートしながら、通貨変動、貿易不均衡、財政政策などを裏付ける経済理論は、より重要性を増しています。これらの経済上の考慮事項の中心にあるのは、消費者行動、政府規制、そしてグローバル危機を含むさまざまな要因によって影響を受けるデリケートなバランスである市場平衡の概念です。

政治的に見ても、この地形も同様に複雑です。イデオロギーの変化とナショナリズムの復活により、外交関係が地政学的緊張の下で試練にさらされる中、国際協定や同盟が検査されています。国連や欧州連合などの超国家機関の仲介役としての役割は極めて重要であり、さらに、ますます多極化する世界における外交手腕の必要性も不可欠です。さらに、経済制裁の有効性についての議論の中でも、政治と経済の交差点が明らかです。

この文脈では、政治的討論で使用される口語表現の微妙な違いを理解し、それが法律用語や経済用語とどのように絡み合っているかを理解することが重要です。たとえば、緊縮財政措置にまつわる言説は、予算立法に関する法的議論やインフレ制御に関する経済議論と絡み合う傾向があります。また、憲法改正に関する議論には政治的ニュアンスが含まれていることが多く、社会全体の問題やイデオロギー的対立を反映しています。

このように、法律、経済、政治の言葉が融合した状況に対処するには、機械翻訳システムにとって独自の課題が生じます。言語的正確さだけでなく、これらの分野の微妙な相互作用の深い理解も求められます。

<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>

Limitation

短文や、非常に長い文章では、stoptokenの不安定化、重複翻訳
4000 token以上では、読み飛ばし等の性能低下が目立ちます
モデルが理解できない概念ではハルシネーション出現しやすくなります
アウトプット利用は自己責任でお願いします

In short sentences or very long texts, the model may experience unstable stop token behavior and duplicate translations. When translating texts longer than 4000 tokens, performance degradation, such as skipping content, becomes evident. The model is also more likely to produce hallucinations when encountering concepts it does not understand. Please use the output at your own risk.

Todo

For the support of multiple languages, there are areas where accuracy has been compromised. We will continue to train more accurate models.

複数の言語の翻訳対応のため、精度が犠牲になっているところがあります。より精度が高いモデルをトレーニングしていきます

Downloads last month
102
Safetensors
Model size
7.33B params
Tensor type
BF16
·