Transformers documentation
EXAONE
이 모델은 2026-11-19에 Hugging Face Transformers에 기여되었습니다.
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
< source >( 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 decoder의 숨겨진 레이어 수. - num_attention_heads (
int, 선택 사항, 기본값32) — Transformer decoder의 각 attention layer에 사용할 attention head의 수입니다. - 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 헤드는 해당 그룹 내 모든 원래 헤드를 평균 풀링(meanpooling)하여 구성해야 합니다. 자세한 내용은 이 논문을 참고하세요. 지정하지 않으면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) — 모델이 마지막 key/values attention을 반환할지 여부입니다(모든 모델에서 사용되지 않음).config.is_decoder=True인 경우 또는 모델이 decoder-only 생성 모델인 경우에만 관련이 있습니다. - 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) — 자기 주의(self-attention) 시 query, key, value 및 출력 투영 계층에 bias를 사용할지 여부입니다. - attention_dropout (
Union[int, float], 선택 사항, 기본값0.0) — Attention 확률에 적용할 dropout 비율입니다. - mlp_bias (
bool, 선택 사항, 기본값False) — MLP 레이어의 up_proj, down_proj, gate_proj 레이어에 bias를 사용할지 여부. - head_dim (
int, 선택 사항) — Attention head의 차원입니다. None인 경우 hidden_size // num_attention_heads 값이 기본값으로 사용됩니다.
이것은 LlamaModel의 구성을 저장하기 위한 구성 클래스입니다. 지정된 인자에 따라 Exaone 모델을 인스턴스화하여 모델 아키텍처를 정의하는 데 사용됩니다. 기본값으로 구성을 인스턴스화하면 LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct와 유사한 구성이 생성됩니다.
Configuration 객체는 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