Transformers documentation

EXAONE

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.23.0).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

このモデルは2026年11月19日にHugging Face Transformersに貢献されました。

FlashAttention SDPA

EXAONE

EXAONEは、LG AI Researchが開発したEXAONE 3.0、EXAONE 3.5、EXAONE Deepの言語モデルをカバーしています。そのアーキテクチャはLlamaと同じですが、パラメータ名と設定名が異なります。

auto クラスは Llama の実装(LlamaModel および LlamaForCausalLM)でこれらをロードするため、EXAONE に固有なのは ExaoneConfig のみです。公開されているチェックポイントは、ロード時に Llama の名前に変更され、保存時に元の名称に戻されます。

以下の例は、AutoModelForCausalLM クラスを使用してテキストを生成する方法を示しています。

from transformers import AutoModelForCausalLM, AutoTokenizer


tokenizer = AutoTokenizer.from_pretrained("LGAI-EXAONE/EXAONE-3.5-2.4B-Instruct")
model = AutoModelForCausalLM.from_pretrained("LGAI-EXAONE/EXAONE-3.5-2.4B-Instruct", device_map="auto")

messages = [{"role": "user", "content": "Explain the Pythagorean theorem in one sentence."}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
output = model.generate(**inputs.to(model.device), max_new_tokens=64)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1] :], skip_special_tokens=True))

ExaoneConfig

クラス transformers.ExaoneConfig

< >

( transformers_version: str | None = Nonearchitectures: list[str] | None = Noneoutput_hidden_states: bool | None = Falsereturn_dict: bool | None = Truedtype: str | torch.dtype | None = Nonechunk_size_feed_forward: int = 0is_encoder_decoder: bool = Falseid2label: dict[int, str] | dict[str, str] | None = Nonelabel2id: dict[str, int] | dict[str, str] | None = Noneproblem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = Nonevocab_size: int = 102400hidden_size: int = 4096intermediate_size: int = 14336num_hidden_layers: int = 32num_attention_heads: int = 32num_key_value_heads: int | None = 8hidden_act: str = 'silu'max_position_embeddings: int = 4096initializer_range: float = 0.02rms_norm_eps: float = 1e-05use_cache: bool = Truepad_token_id: int | None = 0bos_token_id: int | None = 1eos_token_id: int | list[int] | None = 361tie_word_embeddings: bool = Falserope_parameters: transformers.modeling_rope_utils.RopeParameters | dict | None = Noneattention_bias: bool = Falseattention_dropout: int | float | None = 0.0mlp_bias: bool = Falsehead_dim: int | None = None )

パラメータ

  • vocab_size (int、任意、デフォルトは 102400) — モデルの語彙サイズ。input_ids で表現できるトークンの種類数を定義します。
  • hidden_size (int、任意、デフォルトは 4096) — 隠れ表現の次元数。
  • intermediate_size (int、任意、デフォルトは 14336) — MLP 表現の次元数。
  • num_hidden_layers (int、任意、デフォルトは 32) — Transformer デコーダーの隠れ層の数。
  • num_attention_heads (int、任意、デフォルトは 32) — Transformer デコーダーの各アテンション層におけるアテンションヘッドの数。
  • num_key_value_heads (int、任意、デフォルトは8) — Grouped Query Attention の実装に使用する key_value ヘッドの数を指定します。 num_key_value_heads=num_attention_heads の場合、モデルは Multi Head Attention (MHA) を使用し、 num_key_value_heads=1 の場合は Multi Query Attention (MQA) を使用し、それ以外の場合は GQA が使用されます。 マルチヘッドのチェックポイントを GQA のチェックポイントに変換する際は、各グループの key ヘッドと value ヘッドを、そのグループ内の元のすべてのヘッドの平均プーリングによって構築する必要があります。詳細については、この論文を参照してください。指定しない場合、デフォルトで num_attention_heads が使用されます。
  • hidden_act (str、任意、デフォルトは silu) — デコーダーで使用する非線形活性化関数(関数または文字列)。例えば、"gelu"、 "relu"、"silu" など。
  • max_position_embeddings (int、任意、デフォルトは 4096) — このモデルが使用される可能性のある最大シーケンス長です。
  • initializer_range (float、任意、デフォルトは 0.02) — すべての重み行列を初期化するための truncated_normal_initializer の標準偏差です。
  • rms_norm_eps (float、任意、デフォルト値は1e-05) — RMS正規化レイヤーで使用するepsilonです。
  • use_cache (bool、任意、デフォルトは True) — モデルが最後のキー/バリューの注意を返すかどうか(すべてのモデルで利用されるわけではありません)。config.is_decoder=True の場合、またはモデルがデコーダー専用の生成モデルである場合にのみ関連します。
  • pad_token_id (int、任意、デフォルトは 0) — 語彙内でパディングに使用されるトークン ID。
  • bos_token_id (int、任意、デフォルトは 1) — 語彙におけるストリーム開始に使用されるトークン ID。
  • eos_token_id (Union[int, list[int]]、任意、デフォルトは361) — 語彙内でストリーム終了に使用されるトークンID。
  • tie_word_embeddings (bool、任意、デフォルトは False) — モデルの tied_weights_keys マッピングに従って重み埋め込みを共有するかどうかを指定します。
  • rope_parameters (Union[~modeling_rope_utils.RopeParameters, dict], 省略可) — RoPE 埋め込みの設定パラメータを含む辞書です。この辞書には rope_theta の値が含まれており、より長い max_position_embeddings で RoPE を使用する場合にスケーリングに使用されるパラメータが任意で含まれます。
  • attention_bias (bool、任意、デフォルトはFalse) — 自己注意機構において、クエリ、キー、バリュー、出力の投影層にバイアスを使用するかどうかを指定します。
  • attention_dropout (Union[int, float]、任意、デフォルトは 0.0) — アテンション確率のドロップアウト率です。
  • mlp_bias (bool、任意、デフォルトはFalse) — MLP層のup_proj、down_proj、gate_proj層でバイアスを使用するかどうかを指定します。
  • head_dim (int、省略可) — アテンションヘッドの次元です。None の場合、hidden_size // num_attention_heads がデフォルトとして使用されます。

これはLlamaModelの設定を保存するための設定クラスです。指定された引数に基づいてExaoneモデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、LGAI-EXAONE/EXAONE-3.0-7.8B-Instructと類似した設定が得られます。

設定オブジェクトはPreTrainedConfigを継承し、モデルの出力を制御するために使用できます。詳細については、PreTrainedConfigのドキュメントを参照してください。

>>> from transformers import AutoModelForCausalLM, ExaoneConfig

>>> # Initializing an EXAONE-3.0-7.8B style configuration
>>> configuration = ExaoneConfig()

>>> # Initializing a model (which uses the Llama implementation) from that configuration
>>> model = AutoModelForCausalLM.from_config(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
Update on GitHub