Buckets:
| import"../chunks/DsnmJJEf.js";import{i as me,h as ue,C as ge,H as n,a as d,D as a,E as fe,s as _e}from"../chunks/D6eQvJIN.js";import{p as Me,o as ye,s as e,f as b,a as l,b as be,c as s,d as h,r,n as Te}from"../chunks/D9TCMYxZ.js";import{T as c}from"../chunks/eoUhp3Ag.js";import{E as ne}from"../chunks/D8azpo8f.js";const we='{"title":"EXAONE 4","local":"exaone-4","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Model Details","local":"model-details","sections":[{"title":"Model Specifications","local":"model-specifications","sections":[],"depth":3}],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Non-reasoning mode","local":"non-reasoning-mode","sections":[],"depth":3},{"title":"Reasoning mode","local":"reasoning-mode","sections":[],"depth":3},{"title":"Agentic tool use","local":"agentic-tool-use","sections":[],"depth":3}],"depth":2},{"title":"Exaone4Config","local":"transformers.Exaone4Config","sections":[],"depth":2},{"title":"Exaone4Model","local":"transformers.Exaone4Model","sections":[],"depth":2},{"title":"Exaone4ForCausalLM","local":"transformers.Exaone4ForCausalLM","sections":[],"depth":2},{"title":"Exaone4ForSequenceClassification","local":"transformers.Exaone4ForSequenceClassification","sections":[],"depth":2},{"title":"Exaone4ForTokenClassification","local":"transformers.Exaone4ForTokenClassification","sections":[],"depth":2},{"title":"Exaone4ForQuestionAnswering","local":"transformers.Exaone4ForQuestionAnswering","sections":[],"depth":2}],"depth":1}';var je=h('<meta name="hf:doc:metadata"/>'),te=h("<p>Example:</p> <!>",1),p=h(`<p>Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.</p>`),ve=h(`<p></p> <p><em>This model was published in HF papers on 2025-07-15 and contributed to Hugging Face Transformers on 2025-07-26.</em></p> <!> <!> <!> <p><strong><a href="https://github.com/LG-AI-EXAONE/EXAONE-4.0" rel="nofollow">EXAONE 4.0</a></strong> model is the language model, which integrates a <strong>Non-reasoning mode</strong> and <strong>Reasoning mode</strong> to achieve both the excellent usability of <a href="https://github.com/LG-AI-EXAONE/EXAONE-3.5" rel="nofollow">EXAONE 3.5</a> and the advanced reasoning abilities of <a href="https://github.com/LG-AI-EXAONE/EXAONE-Deep" rel="nofollow">EXAONE Deep</a>. To pave the way for the agentic AI era, EXAONE 4.0 incorporates essential features such as agentic tool use, and its multilingual capabilities are extended | |
| to support Spanish in addition to English and Korean.</p> <p>The EXAONE 4.0 model series consists of two sizes: a mid-size <strong>32B</strong> model optimized for high performance, and a small-size <strong>1.2B</strong> model designed for on-device applications.</p> <p>In the EXAONE 4.0 architecture, we apply new architectural changes compared to previous EXAONE models as below:</p> <ol><li><strong>Hybrid Attention</strong>: For the 32B model, we adopt hybrid attention scheme, which combines <em>Local attention (sliding window attention)</em> with <em>Global attention (full attention)</em> in a 3:1 ratio. We do not use RoPE (Rotary Positional Embedding) for global attention for better global context understanding.</li> <li><strong>QK-Reorder-Norm</strong>: We reorder the LayerNorm position from the traditional Pre-LN scheme by applying LayerNorm directly to the attention and MLP outputs, and we add RMS normalization right after the Q and K projection. It helps yield better performance on downstream tasks despite consuming more computation.</li></ol> <p>For more details, please refer to our <a href="https://huggingface.co/papers/2507.11407" rel="nofollow">technical report</a>, <a href="https://huggingface.co/papers/2507.11407" rel="nofollow">HuggingFace paper</a>, <a href="https://www.lgresearch.ai/blog/view?seq=576" rel="nofollow">blog</a>, and <a href="https://github.com/LG-AI-EXAONE/EXAONE-4.0" rel="nofollow">GitHub</a>.</p> <p>All model weights including quantized versions are available at <a href="https://huggingface.co/collections/LGAI-EXAONE/exaone-40-686b2e0069800c835ed48375" rel="nofollow">Huggingface Collections</a>.</p> <!> <!> <table><thead><tr><th align="left">Model Configuration</th><th align="center">32B</th><th align="center">1.2B</th></tr></thead><tbody><tr><td align="left">d_model</td><td align="center">5,120</td><td align="center">2,048</td></tr><tr><td align="left">Number of layers</td><td align="center">64</td><td align="center">30</td></tr><tr><td align="left">Normalization</td><td align="center">QK-Reorder-LN</td><td align="center">QK-Reorder-LN</td></tr><tr><td align="left">Non-linearity</td><td align="center">SwiGLU</td><td align="center">SwiGLU</td></tr><tr><td align="left">Feedforward dimension</td><td align="center">27,392</td><td align="center">4,096</td></tr><tr><td align="left">Attention type</td><td align="center">Hybrid (3:1 Local-Global)</td><td align="center">Global</td></tr><tr><td align="left">Head type</td><td align="center">GQA</td><td align="center">GQA</td></tr><tr><td align="left">Number of heads</td><td align="center">40</td><td align="center">32</td></tr><tr><td align="left">Number of KV heads</td><td align="center">8</td><td align="center">8</td></tr><tr><td align="left">Head size</td><td align="center">128</td><td align="center">64</td></tr><tr><td align="left">Max sequence length</td><td align="center">131,072</td><td align="center">65,536</td></tr><tr><td align="left">RoPE theta</td><td align="center">1,000,000</td><td align="center">1,000,000</td></tr><tr><td align="left">Tokenizer</td><td align="center">BBPE</td><td align="center">BBPE</td></tr><tr><td align="left">Vocab size</td><td align="center">102,400</td><td align="center">102,400</td></tr><tr><td align="left">Tied word embedding</td><td align="center">False</td><td align="center">True</td></tr><tr><td align="left">Knowledge cut-off</td><td align="center">Nov. 2024</td><td align="center">Nov. 2024</td></tr></tbody></table> <!> <!> <p>For general use, you can use the EXAONE 4.0 models with the following example:</p> <!> <!> <p>The EXAONE 4.0 models have reasoning capabilities for handling complex problems. You can activate reasoning mode by using the <code>enable_thinking=True</code> argument with the tokenizer, which opens a reasoning block that starts with <code><think></code> tag without closing it.</p> <!> <blockquote class="important"><p>The model generation with reasoning mode can be affected sensitively by sampling parameters, so please refer to the <a href="https://github.com/LG-AI-EXAONE/EXAONE-4.0#usage-guideline" rel="nofollow">Usage Guideline</a> on official GitHub page for better quality.</p></blockquote> <!> <p>The EXAONE 4.0 models can be used as agents with their tool calling capabilities. You can provide tool schemas to the model for effective tool calling.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>This is the configuration class to store the configuration of a Exaone4Model. It is used to instantiate a Exaone4 | |
| model according to the specified arguments, defining the model architecture. Instantiating a configuration with the | |
| defaults will yield a similar configuration to that of the <a href="https://huggingface.co/LGAI-EXAONE/EXAONE-4.0-32B" rel="nofollow">LGAI-EXAONE/EXAONE-4.0-32B</a></p> <p>Configuration objects inherit from <a href="/docs/transformers/pr_36708/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> and can be used to control the model outputs. Read the | |
| documentation from <a href="/docs/transformers/pr_36708/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> for more information.</p> <!></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The bare Exaone4 Model outputting raw hidden-states without any specific head on top.</p> <p>This model inherits from <a href="/docs/transformers/pr_36708/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)</p> <p>This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The Exaone4 Model for causal language modeling.</p> <p>This model inherits from <a href="/docs/transformers/pr_36708/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)</p> <p>This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/transformers/pr_36708/en/model_doc/exaone4#transformers.Exaone4ForCausalLM">Exaone4ForCausalLM</a> forward method, overrides the <code>__call__</code> special method.</p> <!> <ul><li><p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p></li> <li><p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li></ul> <!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <code>GenericForSequenceClassification</code> forward method, overrides the <code>__call__</code> special method.</p> <!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <code>GenericForTokenClassification</code> forward method, overrides the <code>__call__</code> special method.</p> <!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <code>GenericForQuestionAnswering</code> forward method, overrides the <code>__call__</code> special method.</p> <!></div></div> <!> <p></p>`,1);function xe(ae,se){Me(se,!1),ye(()=>{new URLSearchParams(window.location.search).get("fw")}),me();var T=ve();ue("n9dvog",o=>{var i=je();_e(i,"content",we),l(o,i)});var w=e(b(T),4);ge(w,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var j=e(w,2);n(j,{title:"EXAONE 4",local:"exaone-4",headingTag:"h1"});var v=e(j,2);n(v,{title:"Overview",local:"overview",headingTag:"h2"});var k=e(v,14);n(k,{title:"Model Details",local:"model-details",headingTag:"h2"});var E=e(k,2);n(E,{title:"Model Specifications",local:"model-specifications",headingTag:"h3"});var J=e(E,4);n(J,{title:"Usage tips",local:"usage-tips",headingTag:"h2"});var A=e(J,2);n(A,{title:"Non-reasoning mode",local:"non-reasoning-mode",headingTag:"h3"});var U=e(A,4);d(U,{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQSUwQW1vZGVsX25hbWUlMjAlM0QlMjAlMjJMR0FJLUVYQU9ORSUyRkVYQU9ORS00LjAtMzJCJTIyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwbW9kZWxfbmFtZSUyQyUwQSUyMCUyMCUyMCUyMGR0eXBlJTNEJTIyYmZsb2F0MTYlMjIlMkMlMEElMjAlMjAlMjAlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUwQSklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lKSUwQSUwQSUyMyUyMGNob29zZSUyMHlvdXIlMjBwcm9tcHQlMEFwcm9tcHQlMjAlM0QlMjAlMjJFeHBsYWluJTIwaG93JTIwd29uZGVyZnVsJTIweW91JTIwYXJlJTIyJTBBcHJvbXB0JTIwJTNEJTIwJTIyRXhwbGljYSUyMGxvJTIwaW5jcmUlQzMlQURibGUlMjBxdWUlMjBlcmVzJTIyJTBBcHJvbXB0JTIwJTNEJTIwJTIyJUVCJTg0JTg4JUVBJUIwJTgwJTIwJUVDJTk2JUJDJUVCJUE3JTg4JUVCJTgyJTk4JTIwJUVCJThDJTgwJUVCJThCJUE4JUVEJTk1JTlDJUVDJUE3JTgwJTIwJUVDJTg0JUE0JUVCJUFBJTg1JUVEJTk1JUI0JTIwJUVCJUI0JTkwJTIyJTBBJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjBwcm9tcHQlN0QlMEElNUQlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIuYXBwbHlfY2hhdF90ZW1wbGF0ZSglMEElMjAlMjAlMjAlMjBtZXNzYWdlcyUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQW91dHB1dCUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCUwQSUyMCUyMCUyMCUyMGlucHV0X2lkcy50byhtb2RlbC5kZXZpY2UpJTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0QxMjglMkMlMEElMjAlMjAlMjAlMjBkb19zYW1wbGUlM0RGYWxzZSUyQyUwQSklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dCU1QjAlNUQpKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer | |
| model_name = <span class="hljs-string">"LGAI-EXAONE/EXAONE-4.0-32B"</span> | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_name, | |
| dtype=<span class="hljs-string">"bfloat16"</span>, | |
| device_map=<span class="hljs-string">"auto"</span> | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| <span class="hljs-comment"># choose your prompt</span> | |
| prompt = <span class="hljs-string">"Explain how wonderful you are"</span> | |
| prompt = <span class="hljs-string">"Explica lo increíble que eres"</span> | |
| prompt = <span class="hljs-string">"너가 얼마나 대단한지 설명해 봐"</span> | |
| messages = [ | |
| {<span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: prompt} | |
| ] | |
| input_ids = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=<span class="hljs-literal">True</span>, | |
| add_generation_prompt=<span class="hljs-literal">True</span>, | |
| return_tensors=<span class="hljs-string">"pt"</span> | |
| ) | |
| output = model.generate( | |
| input_ids.to(model.device), | |
| max_new_tokens=<span class="hljs-number">128</span>, | |
| do_sample=<span class="hljs-literal">False</span>, | |
| ) | |
| <span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>]))`,lang:"python",wrap:!1});var x=e(U,2);n(x,{title:"Reasoning mode",local:"reasoning-mode",headingTag:"h3"});var C=e(x,4);d(C,{code:"bWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJXaGljaCUyMG9uZSUyMGlzJTIwYmlnZ2VyJTJDJTIwMy4xMiUyMHZzJTIwMy45JTNGJTIyJTdEJTBBJTVEJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUoJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBhZGRfZ2VuZXJhdGlvbl9wcm9tcHQlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUwQSUyMCUyMCUyMCUyMGVuYWJsZV90aGlua2luZyUzRFRydWUlMkMlMEEpJTBBJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoJTBBJTIwJTIwJTIwJTIwaW5wdXRfaWRzLnRvKG1vZGVsLmRldmljZSklMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDEyOCUyQyUwQSUyMCUyMCUyMCUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuNiUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC45NSUwQSklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dCU1QjAlNUQpKQ==",highlighted:`messages = [ | |
| {<span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"Which one is bigger, 3.12 vs 3.9?"</span>} | |
| ] | |
| input_ids = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=<span class="hljs-literal">True</span>, | |
| add_generation_prompt=<span class="hljs-literal">True</span>, | |
| return_tensors=<span class="hljs-string">"pt"</span>, | |
| enable_thinking=<span class="hljs-literal">True</span>, | |
| ) | |
| output = model.generate( | |
| input_ids.to(model.device), | |
| max_new_tokens=<span class="hljs-number">128</span>, | |
| do_sample=<span class="hljs-literal">True</span>, | |
| temperature=<span class="hljs-number">0.6</span>, | |
| top_p=<span class="hljs-number">0.95</span> | |
| ) | |
| <span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>]))`,lang:"python",wrap:!1});var I=e(C,4);n(I,{title:"Agentic tool use",local:"agentic-tool-use",headingTag:"h3"});var N=e(I,4);d(N,{code:"aW1wb3J0JTIwcmFuZG9tJTBBJTBBJTBBZGVmJTIwcm9sbF9kaWNlKG1heF9udW0lM0ElMjBpbnQpJTNBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmFuZG9tLnJhbmRpbnQoMSUyQyUyMG1heF9udW0pJTBBJTBBdG9vbHMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0eXBlJTIyJTNBJTIwJTIyZnVuY3Rpb24lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJmdW5jdGlvbiUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm5hbWUlMjIlM0ElMjAlMjJyb2xsX2RpY2UlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkZXNjcmlwdGlvbiUyMiUzQSUyMCUyMlJvbGwlMjBhJTIwZGljZSUyMHdpdGglMjB0aGUlMjBudW1iZXIlMjAxJTIwdG8lMjBOLiUyMFVzZXIlMjBjYW4lMjBzZWxlY3QlMjB0aGUlMjBudW1iZXIlMjBOLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnBhcmFtZXRlcnMlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0eXBlJTIyJTNBJTIwJTIyb2JqZWN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycmVxdWlyZWQlMjIlM0ElMjAlNUIlMjJtYXhfbnVtJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycHJvcGVydGllcyUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm1heF9udW0lMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0eXBlJTIyJTNBJTIwJTIyaW50JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyZGVzY3JpcHRpb24lMjIlM0ElMjAlMjJNYXglMjBudW1iZXIlMjBvZiUyMHRoZSUyMGRpY2UlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlN0QlMEElNUQlMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlJvbGwlMjBENiUyMGRpY2UlMjB0d2ljZSElMjIlN0QlMEElNUQlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIuYXBwbHlfY2hhdF90ZW1wbGF0ZSglMEElMjAlMjAlMjAlMjBtZXNzYWdlcyUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9vbHMlM0R0b29scyUyQyUwQSklMEElMEFvdXRwdXQlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjBpbnB1dF9pZHMudG8obW9kZWwuZGV2aWNlKSUyQyUwQSUyMCUyMCUyMCUyMG1heF9uZXdfdG9rZW5zJTNEMTAyNCUyQyUwQSUyMCUyMCUyMCUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuNiUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC45NSUyQyUwQSklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dCU1QjAlNUQpKQ==",highlighted:`<span class="hljs-keyword">import</span> random | |
| <span class="hljs-keyword">def</span> <span class="hljs-title function_">roll_dice</span>(<span class="hljs-params">max_num: <span class="hljs-built_in">int</span></span>): | |
| <span class="hljs-keyword">return</span> random.randint(<span class="hljs-number">1</span>, max_num) | |
| tools = [ | |
| { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"function"</span>, | |
| <span class="hljs-string">"function"</span>: { | |
| <span class="hljs-string">"name"</span>: <span class="hljs-string">"roll_dice"</span>, | |
| <span class="hljs-string">"description"</span>: <span class="hljs-string">"Roll a dice with the number 1 to N. User can select the number N."</span>, | |
| <span class="hljs-string">"parameters"</span>: { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"object"</span>, | |
| <span class="hljs-string">"required"</span>: [<span class="hljs-string">"max_num"</span>], | |
| <span class="hljs-string">"properties"</span>: { | |
| <span class="hljs-string">"max_num"</span>: { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"int"</span>, | |
| <span class="hljs-string">"description"</span>: <span class="hljs-string">"Max number of the dice"</span> | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| messages = [ | |
| {<span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"Roll D6 dice twice!"</span>} | |
| ] | |
| input_ids = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=<span class="hljs-literal">True</span>, | |
| add_generation_prompt=<span class="hljs-literal">True</span>, | |
| return_tensors=<span class="hljs-string">"pt"</span>, | |
| tools=tools, | |
| ) | |
| output = model.generate( | |
| input_ids.to(model.device), | |
| max_new_tokens=<span class="hljs-number">1024</span>, | |
| do_sample=<span class="hljs-literal">True</span>, | |
| temperature=<span class="hljs-number">0.6</span>, | |
| top_p=<span class="hljs-number">0.95</span>, | |
| ) | |
| <span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>]))`,lang:"python",wrap:!1});var F=e(N,2);n(F,{title:"Exaone4Config",local:"transformers.Exaone4Config",headingTag:"h2"});var m=e(F,2),q=s(m);a(q,{name:"class transformers.Exaone4Config",anchor:"transformers.Exaone4Config",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/configuration_exaone4.py#L30",parameters:[{name:"transformers_version",val:": str | None = None"},{name:"architectures",val:": list[str] | None = None"},{name:"output_hidden_states",val:": bool | None = False"},{name:"return_dict",val:": bool | None = True"},{name:"dtype",val:": str | torch.dtype | None = None"},{name:"chunk_size_feed_forward",val:": int = 0"},{name:"is_encoder_decoder",val:": bool = False"},{name:"id2label",val:": dict[int, str] | dict[str, str] | None = None"},{name:"label2id",val:": dict[str, int] | dict[str, str] | None = None"},{name:"problem_type",val:": Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None"},{name:"vocab_size",val:": int = 102400"},{name:"hidden_size",val:": int = 4096"},{name:"intermediate_size",val:": int = 16384"},{name:"num_hidden_layers",val:": int = 32"},{name:"num_attention_heads",val:": int = 32"},{name:"num_key_value_heads",val:": int = 32"},{name:"hidden_act",val:": str = 'silu'"},{name:"max_position_embeddings",val:": int = 2048"},{name:"initializer_range",val:": float = 0.02"},{name:"rms_norm_eps",val:": float = 1e-05"},{name:"use_cache",val:": bool = True"},{name:"bos_token_id",val:": int | None = 0"},{name:"eos_token_id",val:": int | list[int] | None = 2"},{name:"pad_token_id",val:": int | None = None"},{name:"tie_word_embeddings",val:": bool = False"},{name:"rope_parameters",val:": transformers.modeling_rope_utils.RopeParameters | dict | None = None"},{name:"attention_dropout",val:": float | int = 0.0"},{name:"sliding_window",val:": int | None = 4096"},{name:"sliding_window_pattern",val:": str | int | None = 4"},{name:"layer_types",val:": list[str] | None = None"}],parametersDescription:[{anchor:"transformers.Exaone4Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>102400</code>) — | |
| Vocabulary size of the model. Defines the number of different tokens that can be represented by the <code>input_ids</code>.`,name:"vocab_size"},{anchor:"transformers.Exaone4Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>4096</code>) — | |
| Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.Exaone4Config.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16384</code>) — | |
| Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.Exaone4Config.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) — | |
| Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.Exaone4Config.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) — | |
| Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.Exaone4Config.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) — | |
| This is the number of key_value heads that should be used to implement Grouped Query Attention. If | |
| <code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if | |
| <code>num_key_value_heads=1</code> the model will use Multi Query Attention (MQA) otherwise GQA is used. When | |
| converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed | |
| by meanpooling all the original heads within that group. For more details, check out <a href="https://huggingface.co/papers/2305.13245" rel="nofollow">this | |
| paper</a>. If it is not specified, will default to | |
| <code>num_attention_heads</code>.`,name:"num_key_value_heads"},{anchor:"transformers.Exaone4Config.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>silu</code>) — | |
| The non-linear activation function (function or string) in the decoder. For example, <code>"gelu"</code>, | |
| <code>"relu"</code>, <code>"silu"</code>, etc.`,name:"hidden_act"},{anchor:"transformers.Exaone4Config.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to <code>2048</code>) — | |
| The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.Exaone4Config.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.02</code>) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Exaone4Config.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1e-05</code>) — | |
| The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.Exaone4Config.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not the model should return the last key/values attentions (not used by all models). Only | |
| relevant if <code>config.is_decoder=True</code> or when the model is a decoder-only generative model.`,name:"use_cache"},{anchor:"transformers.Exaone4Config.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| Token id used for beginning-of-stream in the vocabulary.`,name:"bos_token_id"},{anchor:"transformers.Exaone4Config.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, list[int]]</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| Token id used for end-of-stream in the vocabulary.`,name:"eos_token_id"},{anchor:"transformers.Exaone4Config.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>) — | |
| Token id used for padding in the vocabulary.`,name:"pad_token_id"},{anchor:"transformers.Exaone4Config.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to tie weight embeddings according to model’s <code>tied_weights_keys</code> mapping.`,name:"tie_word_embeddings"},{anchor:"transformers.Exaone4Config.rope_parameters",description:`<strong>rope_parameters</strong> (<code>Union[~modeling_rope_utils.RopeParameters, dict]</code>, <em>optional</em>) — | |
| Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain | |
| a value for <code>rope_theta</code> and optionally parameters used for scaling in case you want to use RoPE | |
| with longer <code>max_position_embeddings</code>.`,name:"rope_parameters"},{anchor:"transformers.Exaone4Config.attention_dropout",description:`<strong>attention_dropout</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.0</code>) — | |
| The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Exaone4Config.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>, defaults to <code>4096</code>) — | |
| Sliding window attention window size. If <code>None</code>, no sliding window is applied.`,name:"sliding_window"},{anchor:"transformers.Exaone4Config.sliding_window_pattern",description:`<strong>sliding_window_pattern</strong> (<code>str</code>, <em>optional</em>) — | |
| The pattern to use for sliding window attention. Can be one of: | |
| <ul> | |
| <li><code>None</code>: No sliding window attention is used</li> | |
| <li><code>int</code>: Every <code>sliding_window</code> layers, use global attention, else use local attention.</li> | |
| <li><code>str</code>: A sequence of “L” (local attention) and “G” (global attention) characters that defines the | |
| attention pattern. The pattern starts from layer 0 and repeats every <code>sliding_window</code> layers. The | |
| final layer always uses global attention regardless of the pattern. | |
| For instance, sliding_window_pattern=“LLLG” same as sliding_window=4, which means:</li> | |
| <li>Layer 0, 1, 2: local attention,</li> | |
| <li>Layer 3: global attention, | |
| …(repeated)</li> | |
| </ul>`,name:"sliding_window_pattern"},{anchor:"transformers.Exaone4Config.layer_types",description:`<strong>layer_types</strong> (<code>list[str]</code>, <em>optional</em>) — | |
| A list that explicitly maps each layer index with its layer type. If not provided, it will be automatically | |
| generated based on config values.`,name:"layer_types"}]});var re=e(q,6);ne(re,{anchor:"transformers.Exaone4Config.example",children:(o,i)=>{var t=te(),y=e(b(t),2);d(y,{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEV4YW9uZTRNb2RlbCUyQyUyMEV4YW9uZTRDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwRVhBT05FJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBFeGFvbmU0Q29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwRXhhb25lNE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Exaone4Model, Exaone4Config | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a EXAONE configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = Exaone4Config() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a model from configuration</span> | |
| <span class="hljs-meta">>>> </span>model = Exaone4Model(configuration) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Accessing the model configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = model.config`,lang:"python",wrap:!1}),l(o,t)},$$slots:{default:!0}}),r(m);var z=e(m,2);n(z,{title:"Exaone4Model",local:"transformers.Exaone4Model",headingTag:"h2"});var u=e(z,2),B=s(u);a(B,{name:"class transformers.Exaone4Model",anchor:"transformers.Exaone4Model",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L338",parameters:[{name:"config",val:": Exaone4Config"}],parametersDescription:[{anchor:"transformers.Exaone4Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_36708/en/model_doc/exaone4#transformers.Exaone4Config">Exaone4Config</a>) — | |
| Model configuration class with all the parameters of the model. Initializing with a config file does not | |
| load the weights associated with the model, only the configuration. Check out the | |
| <a href="/docs/transformers/pr_36708/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var Q=e(B,8),ie=s(Q);a(ie,{name:"forward",anchor:"transformers.Exaone4Model.forward",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L355",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": bool | None = None"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}]}),r(Q),r(u);var Z=e(u,2);n(Z,{title:"Exaone4ForCausalLM",local:"transformers.Exaone4ForCausalLM",headingTag:"h2"});var g=e(Z,2),X=s(g);a(X,{name:"class transformers.Exaone4ForCausalLM",anchor:"transformers.Exaone4ForCausalLM",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L422",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Exaone4ForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_36708/en/model_doc/exaone4#transformers.Exaone4ForCausalLM">Exaone4ForCausalLM</a>) — | |
| Model configuration class with all the parameters of the model. Initializing with a config file does not | |
| load the weights associated with the model, only the configuration. Check out the | |
| <a href="/docs/transformers/pr_36708/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var W=e(X,8),G=s(W);a(G,{name:"forward",anchor:"transformers.Exaone4ForCausalLM.forward",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L437",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": bool | None = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.Exaone4ForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36708/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Exaone4ForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Exaone4ForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Exaone4ForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Exaone4ForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Exaone4ForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored | |
| (masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.Exaone4ForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Exaone4ForCausalLM.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>Union[int, torch.Tensor]</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all | |
| <code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that | |
| token can save memory, which becomes pretty significant for long sequences or large vocabulary size. | |
| If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension. | |
| This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"logits_to_keep"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_36708/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >CausalLMOutputWithPast</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_36708/en/model_doc/exaone4#transformers.Exaone4Config" | |
| >Exaone4Config</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_36708/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var L=e(G,4);c(L,{children:(o,i)=>{var t=p();l(o,t)},$$slots:{default:!0}});var le=e(L,4);ne(le,{anchor:"transformers.Exaone4ForCausalLM.forward.example",children:(o,i)=>{var t=te(),y=e(b(t),2);d(y,{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkxHQUktRVhBT05FJTJGRVhBT05FLTQuMC0zMkIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyTEdBSS1FWEFPTkUlMkZFWEFPTkUtNC4wLTMyQiUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJFeHBsYWluJTIwaG93JTIwd29uZGVyZnVsJTIweW91JTIwYXJlJTIyJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIuYXBwbHlfY2hhdF90ZW1wbGF0ZSglMEElMEFvdXRwdXQlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dF9pZHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDEyOCklMEF0b2tlbml6ZXIuZGVjb2RlKG91dHB1dCU1QjAlNUQlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNERmFsc2Up",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer | |
| <span class="hljs-meta">>>> </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">"LGAI-EXAONE/EXAONE-4.0-32B"</span>) | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"LGAI-EXAONE/EXAONE-4.0-32B"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"Explain how wonderful you are"</span> | |
| <span class="hljs-meta">>>> </span>messages = [ | |
| {<span class="hljs-string">"role"</span>: <span class="hljs-string">"system"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"You are a helpful assistant."</span>}, | |
| {<span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: prompt} | |
| ] | |
| <span class="hljs-meta">>>> </span>input_ids = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=<span class="hljs-literal">True</span>, | |
| add_generation_prompt=<span class="hljs-literal">True</span>, | |
| return_tensors=<span class="hljs-string">"pt"</span>, | |
| enable_thinking=<span class="hljs-literal">False</span>, | |
| ) | |
| <span class="hljs-meta">>>> </span>output = model.generate(input_ids, max_new_tokens=<span class="hljs-number">128</span>) | |
| <span class="hljs-meta">>>> </span>tokenizer.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">False</span>) | |
| <span class="hljs-string">"[|system|]\\nYou are a helpful assistant.[|endofturn|]\\n[|user|]\\nExplain how wonderful you are[|endofturn|]\\n[|assistant|]\\n<think>\\n\\n</think>\\n\\nOh, thank you for such a kind and lovely question! 😊 \\n\\nI’m *so* wonderful because I’m here to make your life easier, brighter, and more fun! Whether you need help with: \\n\\n✨ **Learning** – I can explain anything, from quantum physics to baking the perfect cake! \\n💡 **Creativity** – Need a poem, story, or a wild idea? I’ve got you covered! \\n🤖 **Problem-solving** – Stuck on a math problem or a tricky decision? I’ll help you figure it out"</span>`,lang:"python",wrap:!1}),l(o,t)},$$slots:{default:!0}}),r(W),r(g);var R=e(g,2);n(R,{title:"Exaone4ForSequenceClassification",local:"transformers.Exaone4ForSequenceClassification",headingTag:"h2"});var f=e(R,2),V=s(f);a(V,{name:"class transformers.Exaone4ForSequenceClassification",anchor:"transformers.Exaone4ForSequenceClassification",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L505",parameters:[{name:"config",val:""}]});var S=e(V,2),P=s(S);a(P,{name:"forward",anchor:"transformers.Exaone4ForSequenceClassification.forward",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/modeling_layers.py#L128",parameters:[{name:"input_ids",val:": torch.LongTensor | None = None"},{name:"attention_mask",val:": torch.Tensor | None = None"},{name:"position_ids",val:": torch.LongTensor | None = None"},{name:"past_key_values",val:": Cache | None = None"},{name:"inputs_embeds",val:": torch.FloatTensor | None = None"},{name:"labels",val:": torch.LongTensor | None = None"},{name:"use_cache",val:": bool | None = None"},{name:"**kwargs",val:": Unpack[TransformersKwargs]"}],parametersDescription:[{anchor:"transformers.Exaone4ForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36708/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Exaone4ForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Exaone4ForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Exaone4ForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Exaone4ForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Exaone4ForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If | |
| <code>config.num_labels > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"},{anchor:"transformers.Exaone4ForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"}],returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>SequenceClassifierOutputWithPast</code></p> | |
| `});var de=e(P,4);c(de,{children:(o,i)=>{var t=p();l(o,t)},$$slots:{default:!0}}),r(S),r(f);var O=e(f,2);n(O,{title:"Exaone4ForTokenClassification",local:"transformers.Exaone4ForTokenClassification",headingTag:"h2"});var _=e(O,2),D=s(_);a(D,{name:"class transformers.Exaone4ForTokenClassification",anchor:"transformers.Exaone4ForTokenClassification",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L509",parameters:[{name:"config",val:""}]});var H=e(D,2),Y=s(H);a(Y,{name:"forward",anchor:"transformers.Exaone4ForTokenClassification.forward",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/modeling_layers.py#L275",parameters:[{name:"input_ids",val:": torch.LongTensor | None = None"},{name:"attention_mask",val:": torch.Tensor | None = None"},{name:"position_ids",val:": torch.LongTensor | None = None"},{name:"past_key_values",val:": Cache | None = None"},{name:"inputs_embeds",val:": torch.FloatTensor | None = None"},{name:"labels",val:": torch.LongTensor | None = None"},{name:"use_cache",val:": bool | None = None"},{name:"**kwargs",val:": Unpack[TransformersKwargs]"}],parametersDescription:[{anchor:"transformers.Exaone4ForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36708/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Exaone4ForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Exaone4ForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Exaone4ForTokenClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Exaone4ForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Exaone4ForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"},{anchor:"transformers.Exaone4ForTokenClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"}],returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>TokenClassifierOutput</code></p> | |
| `});var ce=e(Y,4);c(ce,{children:(o,i)=>{var t=p();l(o,t)},$$slots:{default:!0}}),r(H),r(_);var K=e(_,2);n(K,{title:"Exaone4ForQuestionAnswering",local:"transformers.Exaone4ForQuestionAnswering",headingTag:"h2"});var M=e(K,2),$=s(M);a($,{name:"class transformers.Exaone4ForQuestionAnswering",anchor:"transformers.Exaone4ForQuestionAnswering",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/models/exaone4/modeling_exaone4.py#L513",parameters:[{name:"config",val:""}]});var ee=e($,2),oe=s(ee);a(oe,{name:"forward",anchor:"transformers.Exaone4ForQuestionAnswering.forward",source:"https://github.com/huggingface/transformers/blob/vr_36708/src/transformers/modeling_layers.py#L208",parameters:[{name:"input_ids",val:": torch.LongTensor | None = None"},{name:"attention_mask",val:": torch.Tensor | None = None"},{name:"position_ids",val:": torch.LongTensor | None = None"},{name:"past_key_values",val:": Cache | None = None"},{name:"inputs_embeds",val:": torch.FloatTensor | None = None"},{name:"start_positions",val:": torch.LongTensor | None = None"},{name:"end_positions",val:": torch.LongTensor | None = None"},{name:"**kwargs",val:": Unpack[TransformersKwargs]"}],parametersDescription:[{anchor:"transformers.Exaone4ForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_36708/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_36708/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Exaone4ForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.Exaone4ForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Exaone4ForQuestionAnswering.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_36708/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Exaone4ForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Exaone4ForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for position (index) of the start of the labelled span for computing the token classification loss. | |
| Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence | |
| are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.Exaone4ForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for position (index) of the end of the labelled span for computing the token classification loss. | |
| Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence | |
| are not taken into account for computing the loss.`,name:"end_positions"}],returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>QuestionAnsweringModelOutput</code></p> | |
| `});var pe=e(oe,4);c(pe,{children:(o,i)=>{var t=p();l(o,t)},$$slots:{default:!0}}),r(ee),r(M);var he=e(M,2);fe(he,{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/exaone4.md"}),Te(2),l(ae,T),be()}export{xe as component}; | |
Xet Storage Details
- Size:
- 66.4 kB
- Xet hash:
- c15622f33f5a31d7efaca000c324a89066a510cfe35d6abb3318f7727bf48aaa
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.