import{s as rn,o as ln,n as He}from"../chunks/scheduler.25b97de1.js";import{S as dn,i as cn,g as d,s,r as p,A as mn,h as c,f as o,c as a,j as F,u as h,x as m,k as J,y as r,a as l,v as u,d as f,t as g,w as _}from"../chunks/index.d9030fc9.js";import{T as lt}from"../chunks/Tip.baa67368.js";import{D as Z}from"../chunks/Docstring.ffac8efa.js";import{C as jt}from"../chunks/CodeBlock.e6cd0d95.js";import{E as an}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as A,E as pn}from"../chunks/EditOnGithub.91d95064.js";function hn($){let n,b;return n=new jt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdsbU1vZGVsJTJDJTIwR2xtQ29uZmlnJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEdsbSUyMGdsbS00LTliLWNoYXQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwR2xtQ29uZmlnKCklMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwZ2xtLTQtOWItY2hhdCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwR2xtTW9kZWwoY29uZmlndXJhdGlvbiklMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GlmModel, GlmConfig
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Glm glm-4-9b-chat style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GlmConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the glm-4-9b-chat style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GlmModel(configuration)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){p(n.$$.fragment)},l(i){h(n.$$.fragment,i)},m(i,T){u(n,i,T),b=!0},p:He,i(i){b||(f(n.$$.fragment,i),b=!0)},o(i){g(n.$$.fragment,i),b=!1},d(i){_(n,i)}}}function un($){let n,b=`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.`;return{c(){n=d("p"),n.innerHTML=b},l(i){n=c(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(i,T){l(i,n,T)},p:He,d(i){i&&o(n)}}}function fn($){let n,b=`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.`;return{c(){n=d("p"),n.innerHTML=b},l(i){n=c(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(i,T){l(i,n,T)},p:He,d(i){i&&o(n)}}}function gn($){let n,b="Example:",i,T,C;return T=new jt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHbG1Gb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwR2xtRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmdsbS03YiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZnbG0tN2IlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyV2hhdCUyMGlzJTIweW91ciUyMGZhdm9yaXRlJTIwY29uZGltZW50JTNGJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMuaW5wdXRfaWRzJTJDJTIwbWF4X2xlbmd0aCUzRDMwKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GlmForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = GlmForCausalLM.from_pretrained(<span class="hljs-string">&quot;google/glm-7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/glm-7b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;What is your favorite condiment?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;What is your favorite condiment?&quot;</span>`,wrap:!1}}),{c(){n=d("p"),n.textContent=b,i=s(),p(T.$$.fragment)},l(v){n=c(v,"P",{"data-svelte-h":!0}),m(n)!=="svelte-11lpom8"&&(n.textContent=b),i=a(v),h(T.$$.fragment,v)},m(v,x){l(v,n,x),l(v,i,x),u(T,v,x),C=!0},p:He,i(v){C||(f(T.$$.fragment,v),C=!0)},o(v){g(T.$$.fragment,v),C=!1},d(v){v&&(o(n),o(i)),_(T,v)}}}function _n($){let n,b=`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.`;return{c(){n=d("p"),n.innerHTML=b},l(i){n=c(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(i,T){l(i,n,T)},p:He,d(i){i&&o(n)}}}function bn($){let n,b=`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.`;return{c(){n=d("p"),n.innerHTML=b},l(i){n=c(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=b)},m(i,T){l(i,n,T)},p:He,d(i){i&&o(n)}}}function Tn($){let n,b,i,T,C,v,x,Ue,X,Wt=`The GLM Model was proposed
in <a href="https://arxiv.org/html/2406.12793v1" rel="nofollow">ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools</a>
by GLM Team, THUDM &amp; ZhipuAI.`,Ze,D,Pt="The abstract from the paper is the following:",Ee,Q,Ht=`<em>We introduce ChatGLM, an evolving family of large language models that we have been developing over time. This report
primarily focuses on the GLM-4 language series, which includes GLM-4, GLM-4-Air, and GLM-4-9B. They represent our most
capable models that are trained with all the insights and lessons gained from the preceding three generations of
ChatGLM. To date, the GLM-4 models are pre-trained on ten trillions of tokens mostly in Chinese and English, along with
a small set of corpus from 24 languages, and aligned primarily for Chinese and English usage. The high-quality alignment
is achieved via a multi-stage post-training process, which involves supervised fine-tuning and learning from human
feedback. Evaluations show that GLM-4 1) closely rivals or outperforms GPT-4 in terms of general metrics such as MMLU,
GSM8K, MATH, BBH, GPQA, and HumanEval, 2) gets close to GPT-4-Turbo in instruction following as measured by IFEval, 3)
matches GPT-4 Turbo (128K) and Claude 3 for long context tasks, and 4) outperforms GPT-4 in Chinese alignments as
measured by AlignBench. The GLM-4 All Tools model is further aligned to understand user intent and autonomously decide
when and which tool(s) to use—including web browser, Python interpreter, text-to-image model, and user-defined
functions—to effectively complete complex tasks. In practical applications, it matches and even surpasses GPT-4 All
Tools in tasks like accessing online information via web browsing and solving math problems using Python interpreter.
Over the course, we have open-sourced a series of models, including ChatGLM-6B (three generations), GLM-4-9B (128K, 1M),
GLM-4V-9B, WebGLM, and CodeGeeX, attracting over 10 million downloads on Hugging face in the year 2023 alone.</em>`,Se,Y,Nt="Tips:",Be,K,Ut=`<li>This model was contributed by <a href="https://huggingface.co/THUDM" rel="nofollow">THUDM</a>. The most recent code can be
found <a href="https://github.com/thudm/GLM-4" rel="nofollow">here</a>.</li>`,Re,ee,Ve,te,Zt='<code>GLM-4</code> can be found on the <a href="https://huggingface.co/collections/THUDM/glm-4-665fcf188c414b03c2f7e3b7" rel="nofollow">Huggingface Hub</a>',Oe,ne,Et="In the following, we demonstrate how to use <code>glm-4-9b-chat</code> for the inference. Note that we have used the ChatML format for dialog, in this demo we show how to leverage <code>apply_chat_template</code> for this purpose.",Ae,oe,Xe,se,De,I,ae,dt,ve,St=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmModel">GlmModel</a>. It is used to instantiate an Glm
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 Glm-4-9b-chat.
e.g. <a href="https://huggingface.co/THUDM/glm-4-9b-chat" rel="nofollow">THUDM/glm-4-9b-chat</a>
Configuration objects inherit from <a href="/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ct,E,Qe,re,Ye,w,ie,mt,ye,Bt=`The bare Glm Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/main/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.)`,pt,ke,Rt=`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.`,ht,we,Vt="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>GlmDecoderLayer</code>",ut,q,le,ft,Me,Ot='The <a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmModel">GlmModel</a> forward method, overrides the <code>__call__</code> special method.',gt,S,Ke,de,et,H,ce,_t,z,me,bt,$e,At='The <a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmForCausalLM">GlmForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Tt,B,vt,R,tt,pe,nt,y,he,yt,Ge,Xt="The Glm Model transformer with a sequence classification head on top (linear layer).",kt,Ce,Dt=`<a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmForSequenceClassification">GlmForSequenceClassification</a> uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`,wt,ze,Qt=`Since it does classification on the last token, it requires to know the position of the last token. If a
<code>pad_token_id</code> is defined in the configuration, it finds the last token that is not a padding token in each row. If
no <code>pad_token_id</code> is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when <code>inputs_embeds</code> are passed instead of <code>input_ids</code>, it does the same (take the last value in
each row of the batch).`,Mt,xe,Yt=`This model inherits from <a href="/docs/transformers/main/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.)`,$t,Ie,Kt=`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.`,Gt,j,ue,Ct,Le,en='The <a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmForSequenceClassification">GlmForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',zt,V,ot,fe,st,M,ge,xt,Fe,tn=`The Glm Model transformer with a token classification head on top (a linear layer on top of the hidden-states
output) e.g. for Named-Entity-Recognition (NER) tasks.`,It,Je,nn=`This model inherits from <a href="/docs/transformers/main/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.)`,Lt,qe,on=`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.`,Ft,W,_e,Jt,je,sn='The <a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmForTokenClassification">GlmForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',qt,O,at,be,rt,Ne,it;return C=new A({props:{title:"GLM",local:"glm",headingTag:"h1"}}),x=new A({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ee=new A({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),oe=new jt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjAlMjMlMjB0aGUlMjBkZXZpY2UlMjB0byUyMGxvYWQlMjB0aGUlMjBtb2RlbCUyMG9udG8lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJUSFVETSUyRmdsbS00LTliLWNoYXQlMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJUSFVETSUyRmdsbS00LTliLWNoYXQlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyR2l2ZSUyMG1lJTIwYSUyMHNob3J0JTIwaW50cm9kdWN0aW9uJTIwdG8lMjBsYXJnZSUyMGxhbmd1YWdlJTIwbW9kZWwuJTIyJTBBJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjBwcm9tcHQlN0QlNUQlMEElMEF0ZXh0JTIwJTNEJTIwdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUobWVzc2FnZXMlMkMlMjB0b2tlbml6ZSUzREZhbHNlJTJDJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSklMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCdGV4dCU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUobW9kZWxfaW5wdXRzLmlucHV0X2lkcyUyQyUyMG1heF9uZXdfdG9rZW5zJTNENTEyJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwJTVCb3V0cHV0X2lkcyU1QmxlbihpbnB1dF9pZHMpJTNBJTVEJTIwZm9yJTIwaW5wdXRfaWRzJTJDJTIwb3V0cHV0X2lkcyUyMGluJTIwemlwKG1vZGVsX2lucHV0cy5pbnB1dF9pZHMlMkMlMjBnZW5lcmF0ZWRfaWRzKSU1RCUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-comment"># the device to load the model onto</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;THUDM/glm-4-9b-chat&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;THUDM/glm-4-9b-chat&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Give me a short introduction to large language model.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: prompt}]

<span class="hljs-meta">&gt;&gt;&gt; </span>text = tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>, add_generation_prompt=<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer([text], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=<span class="hljs-number">512</span>, do_sample=<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = [output_ids[<span class="hljs-built_in">len</span>(input_ids):] <span class="hljs-keyword">for</span> input_ids, output_ids <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(model_inputs.input_ids, generated_ids)]

<span class="hljs-meta">&gt;&gt;&gt; </span>response = tokenizer.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),se=new A({props:{title:"GlmConfig",local:"transformers.GlmConfig",headingTag:"h2"}}),ae=new Z({props:{name:"class transformers.GlmConfig",anchor:"transformers.GlmConfig",parameters:[{name:"vocab_size",val:" = 151552"},{name:"hidden_size",val:" = 4096"},{name:"intermediate_size",val:" = 13696"},{name:"num_hidden_layers",val:" = 40"},{name:"num_attention_heads",val:" = 32"},{name:"num_key_value_heads",val:" = 2"},{name:"head_dim",val:" = 128"},{name:"hidden_act",val:" = 'silu'"},{name:"attention_dropout",val:" = 0.0"},{name:"max_position_embeddings",val:" = 131072"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1.5625e-07"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 10000.0"},{name:"pad_token_id",val:" = 151329"},{name:"eos_token_id",val:" = [151329, 151336, 151338]"},{name:"bos_token_id",val:" = None"},{name:"attention_bias",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GlmConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 151552) &#x2014;
Vocabulary size of the Glm model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmModel">GlmModel</a>`,name:"vocab_size"},{anchor:"transformers.GlmConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.GlmConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 13696) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.GlmConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 40) &#x2014;
Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.GlmConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.GlmConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
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 checkout <a href="https://arxiv.org/pdf/2305.13245.pdf" 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.GlmConfig.head_dim",description:`<strong>head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The attention head dimension.`,name:"head_dim"},{anchor:"transformers.GlmConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The legacy activation function. It is overwritten by the <code>hidden_activation</code>.`,name:"hidden_act"},{anchor:"transformers.GlmConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.GlmConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 131072) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.GlmConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.GlmConfig.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1.5625e-07) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.GlmConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
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>.`,name:"use_cache"},{anchor:"transformers.GlmConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie weight embeddings`,name:"tie_word_embeddings"},{anchor:"transformers.GlmConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 10000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.GlmConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 151329) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.GlmConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code> | <code>list</code>, <em>optional</em>, defaults to <code>[151329, 151336, 151338]</code>) &#x2014;
End of stream token id.`,name:"eos_token_id"},{anchor:"transformers.GlmConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Beginning of stream token id.`,name:"bos_token_id"},{anchor:"transformers.GlmConfig.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, defaults to <code>False</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use a bias in the query, key, value and output projection layers during self-attention.`,name:"attention_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/configuration_glm.py#L20"}}),E=new an({props:{anchor:"transformers.GlmConfig.example",$$slots:{default:[hn]},$$scope:{ctx:$}}}),re=new A({props:{title:"GlmModel",local:"transformers.GlmModel",headingTag:"h2"}}),ie=new Z({props:{name:"class transformers.GlmModel",anchor:"transformers.GlmModel",parameters:[{name:"config",val:": GlmConfig"}],parametersDescription:[{anchor:"transformers.GlmModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmConfig">GlmConfig</a>) &#x2014;
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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.
config &#x2014; GlmConfig`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L690"}}),le=new Z({props:{name:"forward",anchor:"transformers.GlmModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Union = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"cache_position",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GlmModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.GlmModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.GlmModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.GlmModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
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>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GlmModel.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GlmModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.GlmModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GlmModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GlmModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GlmModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L726"}}),S=new lt({props:{$$slots:{default:[un]},$$scope:{ctx:$}}}),de=new A({props:{title:"GlmForCausalLM",local:"transformers.GlmForCausalLM",headingTag:"h2"}}),ce=new Z({props:{name:"class transformers.GlmForCausalLM",anchor:"transformers.GlmForCausalLM",parameters:[{name:"config",val:": GlmConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L971"}}),me=new Z({props:{name:"forward",anchor:"transformers.GlmForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Union = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"cache_position",val:": Optional = None"},{name:"num_logits_to_keep",val:": int = 0"}],parametersDescription:[{anchor:"transformers.GlmForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.GlmForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.GlmForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.GlmForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
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>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GlmForCausalLM.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GlmForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.GlmForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GlmForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GlmForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GlmForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.</p>
<p>Args &#x2014;
labels (<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>.</p>
<p>num_logits_to_keep (<code>int</code>, <em>optional</em>):
Calculate logits for the last <code>num_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.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L1001",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.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/main/en/model_doc/glm#transformers.GlmConfig"
>GlmConfig</a>) and inputs.</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>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</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>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),B=new lt({props:{$$slots:{default:[fn]},$$scope:{ctx:$}}}),R=new an({props:{anchor:"transformers.GlmForCausalLM.forward.example",$$slots:{default:[gn]},$$scope:{ctx:$}}}),pe=new A({props:{title:"GlmForSequenceClassification",local:"transformers.GlmForSequenceClassification",headingTag:"h2"}}),he=new Z({props:{name:"class transformers.GlmForSequenceClassification",anchor:"transformers.GlmForSequenceClassification",parameters:[{name:"config",val:": GlmConfig"}],parametersDescription:[{anchor:"transformers.GlmForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmConfig">GlmConfig</a>) &#x2014;
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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L1089"}}),ue=new Z({props:{name:"forward",anchor:"transformers.GlmForSequenceClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Union = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GlmForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.GlmForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.GlmForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.GlmForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
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>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GlmForSequenceClassification.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GlmForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.GlmForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GlmForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GlmForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GlmForSequenceClassification.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.GlmForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
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 &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L1120"}}),V=new lt({props:{$$slots:{default:[_n]},$$scope:{ctx:$}}}),fe=new A({props:{title:"GlmForTokenClassification",local:"transformers.GlmForTokenClassification",headingTag:"h2"}}),ge=new Z({props:{name:"class transformers.GlmForTokenClassification",anchor:"transformers.GlmForTokenClassification",parameters:[{name:"config",val:": GlmConfig"}],parametersDescription:[{anchor:"transformers.GlmForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/glm#transformers.GlmConfig">GlmConfig</a>) &#x2014;
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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L1193"}}),_e=new Z({props:{name:"forward",anchor:"transformers.GlmForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GlmForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.GlmForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.GlmForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.GlmForTokenClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
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>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GlmForTokenClassification.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GlmForTokenClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.GlmForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GlmForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GlmForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GlmForTokenClassification.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.GlmForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
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 &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/glm/modeling_glm.py#L1223"}}),O=new lt({props:{$$slots:{default:[bn]},$$scope:{ctx:$}}}),be=new pn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/glm.md"}}),{c(){n=d("meta"),b=s(),i=d("p"),T=s(),p(C.$$.fragment),v=s(),p(x.$$.fragment),Ue=s(),X=d("p"),X.innerHTML=Wt,Ze=s(),D=d("p"),D.textContent=Pt,Ee=s(),Q=d("p"),Q.innerHTML=Ht,Se=s(),Y=d("p"),Y.textContent=Nt,Be=s(),K=d("ul"),K.innerHTML=Ut,Re=s(),p(ee.$$.fragment),Ve=s(),te=d("p"),te.innerHTML=Zt,Oe=s(),ne=d("p"),ne.innerHTML=Et,Ae=s(),p(oe.$$.fragment),Xe=s(),p(se.$$.fragment),De=s(),I=d("div"),p(ae.$$.fragment),dt=s(),ve=d("p"),ve.innerHTML=St,ct=s(),p(E.$$.fragment),Qe=s(),p(re.$$.fragment),Ye=s(),w=d("div"),p(ie.$$.fragment),mt=s(),ye=d("p"),ye.innerHTML=Bt,pt=s(),ke=d("p"),ke.innerHTML=Rt,ht=s(),we=d("p"),we.innerHTML=Vt,ut=s(),q=d("div"),p(le.$$.fragment),ft=s(),Me=d("p"),Me.innerHTML=Ot,gt=s(),p(S.$$.fragment),Ke=s(),p(de.$$.fragment),et=s(),H=d("div"),p(ce.$$.fragment),_t=s(),z=d("div"),p(me.$$.fragment),bt=s(),$e=d("p"),$e.innerHTML=At,Tt=s(),p(B.$$.fragment),vt=s(),p(R.$$.fragment),tt=s(),p(pe.$$.fragment),nt=s(),y=d("div"),p(he.$$.fragment),yt=s(),Ge=d("p"),Ge.textContent=Xt,kt=s(),Ce=d("p"),Ce.innerHTML=Dt,wt=s(),ze=d("p"),ze.innerHTML=Qt,Mt=s(),xe=d("p"),xe.innerHTML=Yt,$t=s(),Ie=d("p"),Ie.innerHTML=Kt,Gt=s(),j=d("div"),p(ue.$$.fragment),Ct=s(),Le=d("p"),Le.innerHTML=en,zt=s(),p(V.$$.fragment),ot=s(),p(fe.$$.fragment),st=s(),M=d("div"),p(ge.$$.fragment),xt=s(),Fe=d("p"),Fe.textContent=tn,It=s(),Je=d("p"),Je.innerHTML=nn,Lt=s(),qe=d("p"),qe.innerHTML=on,Ft=s(),W=d("div"),p(_e.$$.fragment),Jt=s(),je=d("p"),je.innerHTML=sn,qt=s(),p(O.$$.fragment),at=s(),p(be.$$.fragment),rt=s(),Ne=d("p"),this.h()},l(e){const t=mn("svelte-u9bgzb",document.head);n=c(t,"META",{name:!0,content:!0}),t.forEach(o),b=a(e),i=c(e,"P",{}),F(i).forEach(o),T=a(e),h(C.$$.fragment,e),v=a(e),h(x.$$.fragment,e),Ue=a(e),X=c(e,"P",{"data-svelte-h":!0}),m(X)!=="svelte-1twrbfe"&&(X.innerHTML=Wt),Ze=a(e),D=c(e,"P",{"data-svelte-h":!0}),m(D)!=="svelte-vfdo9a"&&(D.textContent=Pt),Ee=a(e),Q=c(e,"P",{"data-svelte-h":!0}),m(Q)!=="svelte-57yk8e"&&(Q.innerHTML=Ht),Se=a(e),Y=c(e,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-axv494"&&(Y.textContent=Nt),Be=a(e),K=c(e,"UL",{"data-svelte-h":!0}),m(K)!=="svelte-1mv2pve"&&(K.innerHTML=Ut),Re=a(e),h(ee.$$.fragment,e),Ve=a(e),te=c(e,"P",{"data-svelte-h":!0}),m(te)!=="svelte-8dtdop"&&(te.innerHTML=Zt),Oe=a(e),ne=c(e,"P",{"data-svelte-h":!0}),m(ne)!=="svelte-grk520"&&(ne.innerHTML=Et),Ae=a(e),h(oe.$$.fragment,e),Xe=a(e),h(se.$$.fragment,e),De=a(e),I=c(e,"DIV",{class:!0});var N=F(I);h(ae.$$.fragment,N),dt=a(N),ve=c(N,"P",{"data-svelte-h":!0}),m(ve)!=="svelte-yn91dp"&&(ve.innerHTML=St),ct=a(N),h(E.$$.fragment,N),N.forEach(o),Qe=a(e),h(re.$$.fragment,e),Ye=a(e),w=c(e,"DIV",{class:!0});var G=F(w);h(ie.$$.fragment,G),mt=a(G),ye=c(G,"P",{"data-svelte-h":!0}),m(ye)!=="svelte-ferhu"&&(ye.innerHTML=Bt),pt=a(G),ke=c(G,"P",{"data-svelte-h":!0}),m(ke)!=="svelte-hswkmf"&&(ke.innerHTML=Rt),ht=a(G),we=c(G,"P",{"data-svelte-h":!0}),m(we)!=="svelte-13xhxxj"&&(we.innerHTML=Vt),ut=a(G),q=c(G,"DIV",{class:!0});var U=F(q);h(le.$$.fragment,U),ft=a(U),Me=c(U,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-198ia2j"&&(Me.innerHTML=Ot),gt=a(U),h(S.$$.fragment,U),U.forEach(o),G.forEach(o),Ke=a(e),h(de.$$.fragment,e),et=a(e),H=c(e,"DIV",{class:!0});var Te=F(H);h(ce.$$.fragment,Te),_t=a(Te),z=c(Te,"DIV",{class:!0});var L=F(z);h(me.$$.fragment,L),bt=a(L),$e=c(L,"P",{"data-svelte-h":!0}),m($e)!=="svelte-1c9tusn"&&($e.innerHTML=At),Tt=a(L),h(B.$$.fragment,L),vt=a(L),h(R.$$.fragment,L),L.forEach(o),Te.forEach(o),tt=a(e),h(pe.$$.fragment,e),nt=a(e),y=c(e,"DIV",{class:!0});var k=F(y);h(he.$$.fragment,k),yt=a(k),Ge=c(k,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-dtb9he"&&(Ge.textContent=Xt),kt=a(k),Ce=c(k,"P",{"data-svelte-h":!0}),m(Ce)!=="svelte-1wkhz9c"&&(Ce.innerHTML=Dt),wt=a(k),ze=c(k,"P",{"data-svelte-h":!0}),m(ze)!=="svelte-10ugs3m"&&(ze.innerHTML=Qt),Mt=a(k),xe=c(k,"P",{"data-svelte-h":!0}),m(xe)!=="svelte-6pahdo"&&(xe.innerHTML=Yt),$t=a(k),Ie=c(k,"P",{"data-svelte-h":!0}),m(Ie)!=="svelte-hswkmf"&&(Ie.innerHTML=Kt),Gt=a(k),j=c(k,"DIV",{class:!0});var We=F(j);h(ue.$$.fragment,We),Ct=a(We),Le=c(We,"P",{"data-svelte-h":!0}),m(Le)!=="svelte-1eqkwd9"&&(Le.innerHTML=en),zt=a(We),h(V.$$.fragment,We),We.forEach(o),k.forEach(o),ot=a(e),h(fe.$$.fragment,e),st=a(e),M=c(e,"DIV",{class:!0});var P=F(M);h(ge.$$.fragment,P),xt=a(P),Fe=c(P,"P",{"data-svelte-h":!0}),m(Fe)!=="svelte-su1m9x"&&(Fe.textContent=tn),It=a(P),Je=c(P,"P",{"data-svelte-h":!0}),m(Je)!=="svelte-6pahdo"&&(Je.innerHTML=nn),Lt=a(P),qe=c(P,"P",{"data-svelte-h":!0}),m(qe)!=="svelte-hswkmf"&&(qe.innerHTML=on),Ft=a(P),W=c(P,"DIV",{class:!0});var Pe=F(W);h(_e.$$.fragment,Pe),Jt=a(Pe),je=c(Pe,"P",{"data-svelte-h":!0}),m(je)!=="svelte-oy5iod"&&(je.innerHTML=sn),qt=a(Pe),h(O.$$.fragment,Pe),Pe.forEach(o),P.forEach(o),at=a(e),h(be.$$.fragment,e),rt=a(e),Ne=c(e,"P",{}),F(Ne).forEach(o),this.h()},h(){J(n,"name","hf:doc:metadata"),J(n,"content",vn),J(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){r(document.head,n),l(e,b,t),l(e,i,t),l(e,T,t),u(C,e,t),l(e,v,t),u(x,e,t),l(e,Ue,t),l(e,X,t),l(e,Ze,t),l(e,D,t),l(e,Ee,t),l(e,Q,t),l(e,Se,t),l(e,Y,t),l(e,Be,t),l(e,K,t),l(e,Re,t),u(ee,e,t),l(e,Ve,t),l(e,te,t),l(e,Oe,t),l(e,ne,t),l(e,Ae,t),u(oe,e,t),l(e,Xe,t),u(se,e,t),l(e,De,t),l(e,I,t),u(ae,I,null),r(I,dt),r(I,ve),r(I,ct),u(E,I,null),l(e,Qe,t),u(re,e,t),l(e,Ye,t),l(e,w,t),u(ie,w,null),r(w,mt),r(w,ye),r(w,pt),r(w,ke),r(w,ht),r(w,we),r(w,ut),r(w,q),u(le,q,null),r(q,ft),r(q,Me),r(q,gt),u(S,q,null),l(e,Ke,t),u(de,e,t),l(e,et,t),l(e,H,t),u(ce,H,null),r(H,_t),r(H,z),u(me,z,null),r(z,bt),r(z,$e),r(z,Tt),u(B,z,null),r(z,vt),u(R,z,null),l(e,tt,t),u(pe,e,t),l(e,nt,t),l(e,y,t),u(he,y,null),r(y,yt),r(y,Ge),r(y,kt),r(y,Ce),r(y,wt),r(y,ze),r(y,Mt),r(y,xe),r(y,$t),r(y,Ie),r(y,Gt),r(y,j),u(ue,j,null),r(j,Ct),r(j,Le),r(j,zt),u(V,j,null),l(e,ot,t),u(fe,e,t),l(e,st,t),l(e,M,t),u(ge,M,null),r(M,xt),r(M,Fe),r(M,It),r(M,Je),r(M,Lt),r(M,qe),r(M,Ft),r(M,W),u(_e,W,null),r(W,Jt),r(W,je),r(W,qt),u(O,W,null),l(e,at,t),u(be,e,t),l(e,rt,t),l(e,Ne,t),it=!0},p(e,[t]){const N={};t&2&&(N.$$scope={dirty:t,ctx:e}),E.$set(N);const G={};t&2&&(G.$$scope={dirty:t,ctx:e}),S.$set(G);const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),B.$set(U);const Te={};t&2&&(Te.$$scope={dirty:t,ctx:e}),R.$set(Te);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),V.$set(L);const k={};t&2&&(k.$$scope={dirty:t,ctx:e}),O.$set(k)},i(e){it||(f(C.$$.fragment,e),f(x.$$.fragment,e),f(ee.$$.fragment,e),f(oe.$$.fragment,e),f(se.$$.fragment,e),f(ae.$$.fragment,e),f(E.$$.fragment,e),f(re.$$.fragment,e),f(ie.$$.fragment,e),f(le.$$.fragment,e),f(S.$$.fragment,e),f(de.$$.fragment,e),f(ce.$$.fragment,e),f(me.$$.fragment,e),f(B.$$.fragment,e),f(R.$$.fragment,e),f(pe.$$.fragment,e),f(he.$$.fragment,e),f(ue.$$.fragment,e),f(V.$$.fragment,e),f(fe.$$.fragment,e),f(ge.$$.fragment,e),f(_e.$$.fragment,e),f(O.$$.fragment,e),f(be.$$.fragment,e),it=!0)},o(e){g(C.$$.fragment,e),g(x.$$.fragment,e),g(ee.$$.fragment,e),g(oe.$$.fragment,e),g(se.$$.fragment,e),g(ae.$$.fragment,e),g(E.$$.fragment,e),g(re.$$.fragment,e),g(ie.$$.fragment,e),g(le.$$.fragment,e),g(S.$$.fragment,e),g(de.$$.fragment,e),g(ce.$$.fragment,e),g(me.$$.fragment,e),g(B.$$.fragment,e),g(R.$$.fragment,e),g(pe.$$.fragment,e),g(he.$$.fragment,e),g(ue.$$.fragment,e),g(V.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(_e.$$.fragment,e),g(O.$$.fragment,e),g(be.$$.fragment,e),it=!1},d(e){e&&(o(b),o(i),o(T),o(v),o(Ue),o(X),o(Ze),o(D),o(Ee),o(Q),o(Se),o(Y),o(Be),o(K),o(Re),o(Ve),o(te),o(Oe),o(ne),o(Ae),o(Xe),o(De),o(I),o(Qe),o(Ye),o(w),o(Ke),o(et),o(H),o(tt),o(nt),o(y),o(ot),o(st),o(M),o(at),o(rt),o(Ne)),o(n),_(C,e),_(x,e),_(ee,e),_(oe,e),_(se,e),_(ae),_(E),_(re,e),_(ie),_(le),_(S),_(de,e),_(ce),_(me),_(B),_(R),_(pe,e),_(he),_(ue),_(V),_(fe,e),_(ge),_(_e),_(O),_(be,e)}}}const vn='{"title":"GLM","local":"glm","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"GlmConfig","local":"transformers.GlmConfig","sections":[],"depth":2},{"title":"GlmModel","local":"transformers.GlmModel","sections":[],"depth":2},{"title":"GlmForCausalLM","local":"transformers.GlmForCausalLM","sections":[],"depth":2},{"title":"GlmForSequenceClassification","local":"transformers.GlmForSequenceClassification","sections":[],"depth":2},{"title":"GlmForTokenClassification","local":"transformers.GlmForTokenClassification","sections":[],"depth":2}],"depth":1}';function yn($){return ln(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xn extends dn{constructor(n){super(),cn(this,n,yn,Tn,rn,{})}}export{xn as component};
