モデル紹介
コンテンツ詳細
代替品
モデル概要
モデル特徴
モデル能力
使用事例
🚀 SalamandraTAモデルカード
SalamandraTA-2b-instructは、SalamandraTA-2b-baseから命令調整された翻訳用の大規模言語モデル(LLM)です。ベースモデルは、Salamandra-2bを並列データで継続的に事前学習したもので、公開されておらず、内部使用に留まっています。SalamandraTA-2b-instructは35のヨーロッパ言語(および3種類の方言)に対応しており、文レベルの翻訳、段落レベルの翻訳、自動事後編集、文法チェック、機械翻訳評価、代替翻訳、固有表現認識、文脈認識翻訳などの翻訳関連タスクをサポートしています。
⚠️ 重要提示
このバージョンのSalamandraは翻訳タスク専用に調整されています。チャット機能は備えておらず、チャット命令での学習も行われていません。
✨ 主な機能
SalamandraTA-2b-instructは、35のヨーロッパ言語(および3種類の方言)に対応した翻訳用LLMで、以下の翻訳関連タスクをサポートしています。
- 文レベルの翻訳
- 段落レベルの翻訳
- 自動事後編集
- 文法チェック
- 機械翻訳評価
- 代替翻訳
- 固有表現認識
- 文脈認識翻訳
📚 ドキュメント
モデルの詳細
説明
SalamandraTA-2b-baseは、Salamandra-2bを並列データを用いて継続的に事前学習したもので、学習中に合計4240億トークンが処理されました。
アーキテクチャ
属性 | 詳情 |
---|---|
総パラメータ数 | 2,253,490,176 |
埋め込みパラメータ数 | 524,288,000 |
レイヤー数 | 24 |
隠れ層サイズ | 2,048 |
アテンションヘッド数 | 16 |
コンテキスト長 | 8,192 |
語彙サイズ | 256,000 |
精度 | bfloat16 |
埋め込みタイプ | RoPE |
活性化関数 | SwiGLU |
レイヤー正規化 | RMS Norm |
フラッシュアテンション | ✅ |
グループ化クエリアテンション | ❌ |
クエリグループ数 | N/A |
想定される使用方法
直接使用
このモデルは、学習データに含まれるいずれかの言語での一般的な機械翻訳タスクにおいて、研究および商用利用を目的としています。
想定外の使用
このモデルは、他人を害したり人権を侵害したりするなどの悪意のある活動には使用されることを想定していません。また、適切なリスク評価と軽減策を行わずに本番環境での無責任な使用も推奨されません。すべての下流アプリケーションは現行の法律や規制に準拠する必要があります。
ハードウェアとソフトウェア
学習フレームワーク
SalamandraTA-2b-baseは、NVIDIAのNeMo Frameworkを使用して継続的に事前学習されました。このフレームワークは、高度に分散された環境での効率的なモデル学習のためにPyTorch Lightningを活用しています。SalamandraTA-2b-instructはFastChatを用いて生成されました。
コンピューティングインフラストラクチャ
すべてのモデルは、バルセロナスーパーコンピューティングセンターがホストおよび運営するプレエクサスケールのEuroHPCスーパーコンピュータであるMareNostrum 5上で学習されました。
加速パーティションは、以下の仕様の1,120ノードで構成されています。
- 64GB HBM2メモリを搭載した4台のNvidia Hopper GPU
- それぞれ2.3Ghz、32コアの2台のIntel Sapphire Rapids 8460Y+(合計64コア)
- 4台のNDR200(ノードあたりの帯域幅800Gb/s)
- 512GBのメインメモリ(DDR5)
- 460GBのNVMeストレージ
使い方
以下の35の言語(および3種類の方言)間での翻訳が可能です。
アラゴン語、アストゥリアス語、バスク語、ブルガリア語、カタルーニャ語(およびカタルーニャ語 - バレンシア方言)、クロアチア語、チェコ語、デンマーク語、オランダ語、英語、エストニア語、フィンランド語、フランス語、ガリシア語、ドイツ語、ギリシャ語、ハンガリー語、アイルランド語、イタリア語、ラトビア語、リトアニア語、マルタ語、ノルウェー語(ボクモール語およびニーノルスク語の方言)、オック語(およびアラネス語方言)、ポーランド語、ポルトガル語、ルーマニア語、ロシア語、セルビア語、スロバキア語、スロベニア語、スペイン語、スウェーデン語、ウクライナ語、ウェールズ語。
命令に従うモデルは、一般的に採用されているChatMLテンプレートを使用しています。
<|im_start|>system
{システムプロンプト}<|im_end|>
<|im_start|>user
{ユーザープロンプト}<|im_end|>
<|im_start|>assistant
{モデル応答}<|im_end|>
<|im_start|>user
[...]
適用する最も簡単な方法は、トークナイザの組み込み関数を使用することです。以下のコードスニペットに示す通りです。
from datetime import datetime
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model_id = "BSC-LT/salamandraTA-2b-instruct"
source = 'Spanish'
target = 'Catalan'
sentence = "Ayer se fue, tomó sus cosas y se puso a navegar. Una camisa, un pantalón vaquero y una canción, dónde irá, dónde irá. Se despidió, y decidió batirse en duelo con el mar. Y recorrer el mundo en su velero. Y navegar, nai-na-na, navegar"
text = f"Translate the following text from {source} into {target}.\n{source}: {sentence} \n{target}:"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16
)
message = [ { "role": "user", "content": text } ]
date_string = datetime.today().strftime('%Y-%m-%d')
prompt = tokenizer.apply_chat_template(
message,
tokenize=False,
add_generation_prompt=True,
date_string=date_string
)
inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
input_length = inputs.shape[1]
outputs = model.generate(input_ids=inputs.to(model.device),
max_new_tokens=400,
early_stopping=True,
num_beams=5)
print(tokenizer.decode(outputs[0, input_length:], skip_special_tokens=True))
# Ahir se'n va anar, va recollir les seves coses i es va fer a la mar. Una camisa, uns texans i una cançó, on anirà, on anirà. Es va acomiadar i va decidir batre's en duel amb el mar. I fer la volta al món en el seu veler. I navegar, nai-na-na, navegar
このテンプレートを使用すると、各ターンは<|im_start|>
区切り文字とエンティティの役割(ユーザーが提供するコンテンツの場合はuser
、LLMの応答の場合はassistant
)で始まり、<|im_end|>
トークンで終わります。
一般的な翻訳
機械翻訳タスクでは、以下のプロンプトテンプレートを使用できます。
Translate the following text from {source} into {target}.
{source}: {source sentence}
{target}:
例を表示
source = 'Catalan'
target = 'Galician'
source_sentence = "Als antics egipcis del període de l'Imperi Nou els fascinaven els monuments dels seus predecessors, que llavors tenien més de mil anys."
text = f"Translate the following text from {source} into {target}.\n{source}: {source_sentence} \n{target}:"
# Os antigos exipcios do período do Imperio Novo estaban fascinados polos monumentos dos seus predecesores, que entón tiñan máis de mil anos de antigüidade.
事後編集
事後編集タスクでは、以下のプロンプトテンプレートを使用できます。
Please fix any mistakes in the following {source}-{target} machine translation or keep it unedited if it's correct.
Source: {source_sentence}
MT: {machine_translation}
Corrected:"
例を表示
source = 'Catalan'
target = 'English'
source_sentence = 'Rafael Nadal i Maria Magdalena van inspirar a una generació sencera.'
machine_translation = 'Rafael Christmas and Maria the Muffin inspired an entire generation each in their own way.'
text = f"Please fix any mistakes in the following {source}-{target} machine translation or keep it unedited if it's correct.\nSource: {source_sentence} \nMT: {machine_translation} \nCorrected:"
# Rafael Nadal and Maria Magdalena inspired an entire generation.
段落レベルの翻訳
段落レベルの翻訳タスクでは、以下のプロンプトテンプレートを使用できます。
Please translate this text from {source} into {target}.
{source}: {paragraph}
{target}:
例を表示
source = 'English'
target = 'Asturian'
text = """Please translate this text from {} into {}.\n{}: President Donald Trump, who campaigned on promises to crack down on illegal immigration, has raised alarms in the U.S. dairy industry with his threat to impose 25% tariffs on Mexico and Canada by February 2025. This move is part of a broader strategy to declare a national emergency at the southern border to halt illegal migration completely. However, the implications for the agriculture sector, particularly dairy, are significant. Approximately half of the U.S. dairy industry's workforce consists of immigrant labor, many of whom are undocumented. The National Milk Producers Federation estimates that removing immigrant workers could decimate the dairy herd by 2.1 million cows and slash milk production by nearly 50 billion pounds, leading to a dramatic 90.4% increase in milk prices. The complex perspectives of Americans on undocumented workers were highlighted in a Pew Research Center study. While 64% of U.S. adults support legal pathways for undocumented immigrants, 35% oppose it—a gap that has been narrowing recently. Factors influencing public opinion include the belief that immigrants should have jobs and pass security checks, contrasted by concerns about lawbreakers being rewarded, fairness for legal migrants, and resource allocation.
{}:""".format(source, target, source, target)
固有表現認識
固有表現認識タスクでは、以下のプロンプトテンプレートを使用できます。
Analyse the following tokenized text and mark the tokens containing named entities.
Use the following annotation guidelines with these tags for named entities:
- ORG (Refers to named groups or organizations)
- PER (Refers to individual people or named groups of people)
- LOC (Refers to physical places or natural landmarks)
- MISC (Refers to entities that don't fit into standard categories).
Prepend B- to the first token of a given entity and I- to the remaining ones if they exist.
If a token is not a named entity, label it as O.
Input: {list of words in a sentence}
Marked:
例を表示
text = """Analyse the following tokenized text and mark the tokens containing named entities.
Use the following annotation guidelines with these tags for named entities:
- ORG (Refers to named groups or organizations)
- PER (Refers to individual people or named groups of people)
- LOC (Refers to physical places or natural landmarks)
- MISC (Refers to entities that don't fit into standard categories).
Prepend B- to the first token of a given entity and I- to the remaining ones if they exist.
If a token is not a named entity, label it as O.
Input: ['La', 'defensa', 'del', 'antiguo', 'responsable', 'de', 'la', 'RFEF', 'confirma', 'que', 'interpondrá', 'un', 'recurso.']
Marked: """
# [('La', 'O'), ('defensa', 'O'), ('del', 'O'), ('antiguo', 'O'), ('responsable', 'O'), ('de', 'O'), ('la', 'O'), ('RFEF', 'B-ORG'), ('confirma', 'O'), ('que', 'O'), ('interpondrá', 'O'), ('un', 'O'), ('recurso.', 'O')]
文法チェッカー
文法の誤りを修正するには、以下のプロンプトテンプレートを使用できます。
Please fix any mistakes in the following {source} sentence or keep it unedited if it's correct.
Sentence: {sentence}
Corrected:
例を表示
source = 'Catalan'
sentence = 'Entonses, el meu jefe m’ha dit que he de treballar els fins de setmana.'
text = f"Please fix any mistakes in the following {source} sentence or keep it unedited if it's correct.\nSentence: {sentence} \nCorrected:"
# Llavors, el meu cap m'ha dit que he de treballar els caps de setmana.
データ
事前学習データ
事前学習コーパスは、カタルーニャ語中心、スペイン語中心、英語中心の並列データ4240億トークンで構成されており、すべての欧州の公式言語に加え、カタルーニャ語、バスク語、ガリシア語、アストゥリアス語、アラゴン語、アラネス語が含まれています。合計6,574,251,526の並列文ペアに相当します。
この高度に多言語なコーパスは、主にOPUSから取得したデータで構成されており、追加のデータはNTEU Project、Aina Project、およびその他のソースから取得されています(詳細はデータソースおよび参考文献を参照)。カタルーニャ語 <-> xxの並列データが少ない場合、収集したスペイン語 <-> xxコーパスのスペイン語側から、Projecte Ainaのスペイン語 - カタルーニャ語モデルを使用して合成カタルーニャ語データが生成されました。最終的な言語の分布は以下の通りです。
学習データに含まれるコーパスの完全なリストを表示するには、以下の展開ボタンをクリックしてください。
データソース
データセット | Ca-xx言語 | Es-xx言語 | En-xx言語 |
---|---|---|---|
AINA | en | ||
ARANESE-SYNTH-CORPUS-BSC | arn | ||
BOUA-SYNTH-BSC | val | ||
BOUMH | val | ||
BOUA-PILAR | val | ||
CCMatrix | eu | ga | |
DGT | bg,cs,da,de,el,et,fi,fr,ga,hr,hu,lt,lv,mt,nl,pl,pt,ro,sk,sl,sv | da,et,ga,hr,hu,lt,lv,mt,sh,sl | |
DOGV-SYNTH-BSC | val | ||
DOGV-PILAR | val | ||
ELRC-EMEA | bg,cs,da,hu,lt,lv,mt,pl,ro,sk,sl | et,hr,lv,ro,sk,sl | |
EMEA | bg,cs,da,el,fi,hu,lt,mt,nl,pl,ro,sk,sl,sv | et,mt | |
EUBookshop | lt,pl,pt | cs,da,de,el,fi,fr,ga,it,lv,mt,nl,pl,pt,ro,sk,sl,sv | cy,ga |
Europarl | bg,cs,da,el,en,fi,fr,hu,lt,lv,nl,pl,pt,ro,sk,sl,sv | ||
Europat | en,hr | no | |
GAITU Corpus | eu | ||
KDE4 | bg,cs,da,de,el,et,eu,fi,fr,ga,gl,hr,it,lt,lv,nl,pl,pt,ro,sk,sl,sv | bg,ga,hr | cy,ga,nn,oc |
GlobalVoices | bg,de,fr,it,nl,pl,pt | bg,de,fr,pt | |
GNOME | eu,fr,ga,gl,pt | ga | cy,ga,nn |
JRC-Arquis | cs,da,et,fr,lt,lv,mt,nl,pl,ro,sv | et | |
LES-CORTS-VALENCIANES-SYNTH-BSC | val | ||
MaCoCu | en | hr,mt,uk | |
MultiCCAligned | bg,cs,de,el,et,fi,fr,hr,hu,it,lt,lv,nl,pl,ro,sk,sv | bg,fi,fr,hr,it,lv,nl,pt | bg,cy,da,et,fi,hr,hu,lt,lv,no,sl,sr,uk |
MultiHPLT | en, et,fi,ga,hr,mt | fi,ga,gl,hr,mt,nn,sr | |
MultiParaCrawl | bg,da | de,en,fr,ga,hr,hu,it,mt,pt | bg,cs,da,de,el,et,fi,fr,ga,hr,hu,lt,lv,mt,nn,pl,ro,sk,sl,uk |
MultiUN | fr | ||
News-Commentary | fr | ||
NLLB | bg,da,el,en,et,fi,fr,gl,hu,it,lt,lv,pt,ro,sk,sl | bg,cs,da,de,el,et,fi,fr,hu,it,lt,lv,nl,pl,pt,ro,sk,sl,sv | bg,cs,cy,da,de,el,et,fi,fr,ga,hr,hu,it,lt,lv,mt,nl,no,oc,pl,pt,ro,ru,sk,sl,sr,sv,uk |
NÓS Authentic Corpus | gl | ||
NÓS Synthetic Corpus | gl | ||
NTEU | bg,cs,da,de,el,en,et,fi,fr,ga,hr,hu,it,lt,lv,mt,nl,pl,pt,ro,sk,sl,sv | da,et,ga,hr,lt,lv,mt,ro,sk,sl,sv | |
OpenSubtitles | bg,cs,da,de,el,et,eu,fi,gl,hr,hu,lt,lv,nl,pl,pt,ro,sk,sl,sv | da,de,fi,fr,hr,hu,it,lv,nl | bg,cs,de,el,et,hr,fi,fr,hr,hu,no,sl,sr |
OPUS-100 | en | gl | |
StanfordNLP-NMT | cs | ||
Tatoeba | de,pt | pt | |
TildeModel | bg | et,hr,lt,lv,mt | |
UNPC | en,fr | ru | |
PILAR-VALENCIAN-AUTH | val | ||
PILAR-VALENCIAN-SYNTH | val | ||
WikiMatrix | bg,cs,da,de,el,et,eu,fi,fr,gl,hr,hu,it,lt,nl,pl,pt,ro,sk,sl,sv | bg,en,fr,hr,it,pt | oc,sh |
Wikimedia | cy,nn | ||
XLENT | eu,ga,gl | ga | cy,et,ga,gl,hr,oc,sh |
名前に "-BSC" が含まれるデータセット(例: BOUA-SYNTH-BSC、DOGV-SYNTH-BSC)は、既存の単言語コーパスを独自のseq-to-seqモデルで機械翻訳することで得られた合成データセットです。これらのデータセットはモデル学習のために内部で生成されており、公開されていません。
それぞれのライセンス付きのデータ概要ドキュメントを参照するには、ipr@bsc.esにメールを送信してください。
参考文献
- Aulamo, M., Sulubacak, U., Virpioja, S., & Tiedemann, J. (2020). OpusTools and Parallel Corpus Diagnostics. In N. Calzolari, F. Béchet, P. Blache, K. Choukri, C. Cieri, T. Declerck, S. Goggi, H. Isahara, B. Maegaard, J. Mariani, H. Mazo, A. Moreno, J. Odijk, & S. Piperidis (Eds.), Proceedings of the Twelfth Language Resources and Evaluation Conference (pp. 3782–3789). European Language Resources Association. https://aclanthology.org/2020.lrec-1.467
- Chaudhary, V., Tang, Y., Guzmán, F., Schwenk, H., & Koehn, P. (2019). Low-Resource Corpus Filtering Using Multilingual Sentence Embeddings. In O. Bojar, R. Chatterjee, C. Federmann, M. Fishel, Y. Graham, B. Haddow, M. Huck, A. J. Yepes, P. Koehn, A. Martins, C. Monz, M. Negri, A. Névéol, M. Neves, M. Post, M. Turchi, & K. Verspoor (Eds.), Proceedings of the Fourth Conference on Machine Translation (Volume 3: Shared Task Papers, Day 2) (pp. 261–266). Association for Computational Linguistics. https://doi.org/10.18653/v1/W19-5435
- DGT-Translation Memory—European Commission. (n.d.). Retrieved November 4, 2024, from https://joint-research-centre.ec.europa.eu/language-technology-resources/dgt-translation-memory_en
- Eisele, A., & Chen, Y. (2010). MultiUN: A Multilingual Corpus from United Nation Documents. In N. Calzolari,
📄 ライセンス
このモデルはApache-2.0ライセンスの下で提供されています。








おすすめAIモデル



