import{S as zs,i as Es,s as xs,e as n,k as p,w as k,t as a,M as qs,c as s,d as o,m,a as r,x as C,h as i,b as d,G as e,g,y as $,q as w,o as y,B as A,v as Ls,L as Dn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ps}from"../../chunks/Tip-hf-doc-builder.js";import{D as ce}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Nn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as rt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as In}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Fs(E){let c,b,_,u,v;return u=new Nn({props:{code:`from transformers import CpmAntModel, CpmAntConfig

# Initializing a CPMAnt cpm-ant-10b style configuration
configuration = CpmAntConfig()

# Initializing a model from the cpm-ant-10b style configuration
model = CpmAntModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CpmAntModel, CpmAntConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CPMAnt cpm-ant-10b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CpmAntConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the cpm-ant-10b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CpmAntModel(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`}}),{c(){c=n("p"),b=a("Example:"),_=p(),k(u.$$.fragment)},l(l){c=s(l,"P",{});var f=r(c);b=i(f,"Example:"),f.forEach(o),_=m(l),C(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),$(u,l,f),v=!0},p:Dn,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){y(u.$$.fragment,l),v=!1},d(l){l&&o(c),l&&o(_),A(u,l)}}}function Os(E){let c,b,_,u,v;return{c(){c=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var f=r(c);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var L=r(_);u=i(L,"Module"),L.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c,f),e(c,b),e(c,_),e(_,u),e(c,v)},d(l){l&&o(c)}}}function js(E){let c,b,_,u,v;return u=new Nn({props:{code:`from transformers import AutoTokenizer, CpmAntModel
import torch

tokenizer = AutoTokenizer.from_pretrained("openbmb/cpm-ant-10b")
model = CpmAntModel.from_pretrained("openbmb/cpm-ant-10b")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CpmAntModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CpmAntModel.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){c=n("p"),b=a("Example:"),_=p(),k(u.$$.fragment)},l(l){c=s(l,"P",{});var f=r(c);b=i(f,"Example:"),f.forEach(o),_=m(l),C(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),$(u,l,f),v=!0},p:Dn,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){y(u.$$.fragment,l),v=!1},d(l){l&&o(c),l&&o(_),A(u,l)}}}function Is(E){let c,b,_,u,v;return{c(){c=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=s(l,"P",{});var f=r(c);b=i(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(f,"CODE",{});var L=r(_);u=i(L,"Module"),L.forEach(o),v=i(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c,f),e(c,b),e(c,_),e(_,u),e(c,v)},d(l){l&&o(c)}}}function Ds(E){let c,b,_,u,v;return u=new Nn({props:{code:`import torch
from transformers import AutoTokenizer, CpmAntForCausalLM

tokenizer = AutoTokenizer.from_pretrained("openbmb/cpm-ant-10b")
model = CpmAntForCausalLM.from_pretrained("openbmb/cpm-ant-10b")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CpmAntForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CpmAntForCausalLM.from_pretrained(<span class="hljs-string">&quot;openbmb/cpm-ant-10b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=n("p"),b=a("Example:"),_=p(),k(u.$$.fragment)},l(l){c=s(l,"P",{});var f=r(c);b=i(f,"Example:"),f.forEach(o),_=m(l),C(u.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),$(u,l,f),v=!0},p:Dn,i(l){v||(w(u.$$.fragment,l),v=!0)},o(l){y(u.$$.fragment,l),v=!1},d(l){l&&o(c),l&&o(_),A(u,l)}}}function Ns(E){let c,b,_,u,v,l,f,L,Yt,Mt,I,J,at,pe,Zt,it,eo,Pt,me,to,he,oo,zt,Ne,no,Et,F,so,ue,ro,ao,fe,io,lo,xt,Be,co,qt,Se,ge,po,_e,mo,ho,Lt,D,K,lt,ve,uo,dt,fo,Ft,M,be,go,N,_o,We,vo,bo,ke,ko,Co,$o,B,wo,He,yo,Ao,Ue,To,Mo,Po,Q,Ot,S,X,ct,Ce,zo,pt,Eo,jt,P,$e,xo,mt,qo,Lo,O,we,Fo,ht,Oo,jo,ut,ye,Io,ft,Do,No,Bo,Y,Ae,So,Te,Wo,gt,Ho,Uo,It,W,Z,_t,Me,Vo,vt,Ro,Dt,z,Pe,Go,ze,Jo,Ee,Ko,Qo,Xo,H,Yo,Ve,Zo,en,Re,tn,on,nn,x,xe,sn,U,rn,Ge,an,ln,bt,dn,cn,pn,ee,mn,te,Nt,V,oe,kt,qe,hn,Ct,un,Bt,T,Le,fn,$t,gn,_n,Fe,vn,Oe,bn,kn,Cn,R,$n,Je,wn,yn,Ke,An,Tn,Mn,q,je,Pn,G,zn,Qe,En,xn,wt,qn,Ln,Fn,ne,On,se,St;return l=new rt({}),pe=new rt({}),ve=new rt({}),be=new ce({props:{name:"class transformers.CpmAntConfig",anchor:"transformers.CpmAntConfig",parameters:[{name:"vocab_size",val:": int = 30720"},{name:"hidden_size",val:": int = 4096"},{name:"num_attention_heads",val:": int = 32"},{name:"dim_head",val:": int = 128"},{name:"dim_ff",val:": int = 10240"},{name:"num_hidden_layers",val:": int = 48"},{name:"dropout_p",val:": int = 0.0"},{name:"position_bias_num_buckets",val:": int = 512"},{name:"position_bias_max_distance",val:": int = 2048"},{name:"eps",val:": int = 1e-06"},{name:"init_std",val:": float = 1.0"},{name:"prompt_types",val:": int = 32"},{name:"prompt_length",val:": int = 32"},{name:"segment_types",val:": int = 32"},{name:"use_cache",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30720) &#x2014;
Vocabulary size of the CPMAnt model. Defines the number of different tokens that can be represented by the
<code>input</code> passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/cpmant#transformers.CpmAntModel">CpmAntModel</a>.`,name:"vocab_size"},{anchor:"transformers.CpmAntConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the encoder layers.`,name:"hidden_size"},{anchor:"transformers.CpmAntConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of attention heads in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.CpmAntConfig.dim_head",description:`<strong>dim_head</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Dimension of attention heads for each attention layer in the Transformer encoder.`,name:"dim_head"},{anchor:"transformers.CpmAntConfig.dim_ff",description:`<strong>dim_ff</strong> (<code>int</code>, <em>optional</em>, defaults to 10240) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"dim_ff"},{anchor:"transformers.CpmAntConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 48) &#x2014;
Number of layers of the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.CpmAntConfig.dropout_p",description:`<strong>dropout_p</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder.`,name:"dropout_p"},{anchor:"transformers.CpmAntConfig.position_bias_num_buckets",description:`<strong>position_bias_num_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The number of position_bias buckets.`,name:"position_bias_num_buckets"},{anchor:"transformers.CpmAntConfig.position_bias_max_distance",description:`<strong>position_bias_max_distance</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"position_bias_max_distance"},{anchor:"transformers.CpmAntConfig.eps",description:`<strong>eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"eps"},{anchor:"transformers.CpmAntConfig.prompt_types",description:`<strong>prompt_types</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The type of prompt.`,name:"prompt_types"},{anchor:"transformers.CpmAntConfig.prompt_length",description:`<strong>prompt_length</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The length of prompt.`,name:"prompt_length"},{anchor:"transformers.CpmAntConfig.segment_types",description:`<strong>segment_types</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The type of segment.`,name:"segment_types"},{anchor:"transformers.CpmAntConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use cache.`,name:"use_cache"},{anchor:"transformers.CpmAntConfig.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Initialize parameters with std = init_std.`,name:"init_std"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/configuration_cpmant.py#L29"}}),Q=new In({props:{anchor:"transformers.CpmAntConfig.example",$$slots:{default:[Fs]},$$scope:{ctx:E}}}),Ce=new rt({}),$e=new ce({props:{name:"class transformers.CpmAntTokenizer",anchor:"transformers.CpmAntTokenizer",parameters:[{name:"vocab_file",val:""},{name:"bod_token",val:" = '<d>'"},{name:"eod_token",val:" = '</d>'"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"pad_token",val:" = '<pad>'"},{name:"unk_token",val:" = '<unk>'"},{name:"line_token",val:" = '</n>'"},{name:"space_token",val:" = '</_>'"},{name:"padding_side",val:" = 'left'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CpmAntTokenizer.bod_token",description:`<strong>bod_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;d&gt;&quot;</code>) &#x2014;
The beginning of document token.`,name:"bod_token"},{anchor:"transformers.CpmAntTokenizer.eod_token",description:`<strong>eod_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/d&gt;&quot;</code>) &#x2014;
The end of document token.`,name:"eod_token"},{anchor:"transformers.CpmAntTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.CpmAntTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.CpmAntTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding.`,name:"pad_token"},{anchor:"transformers.CpmAntTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token.`,name:"unk_token"},{anchor:"transformers.CpmAntTokenizer.line_token",description:`<strong>line_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/n&gt;&quot;</code>) &#x2014;
The line token.`,name:"line_token"},{anchor:"transformers.CpmAntTokenizer.space_token",description:`<strong>space_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/_&gt;&quot;</code>) &#x2014;
The space token.`,name:"space_token"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/tokenization_cpmant.py#L88"}}),we=new ce({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.CpmAntTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.List[int] = None"}],parametersDescription:[{anchor:"transformers.CpmAntTokenizer.build_inputs_with_special_tokens.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; The first tokenized sequence that special tokens will be added.",name:"token_ids_0"},{anchor:"transformers.CpmAntTokenizer.build_inputs_with_special_tokens.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>) &#x2014; The optional second tokenized sequence that special tokens will be added.",name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/tokenization_cpmant.py#L235",returnDescription:`
<p>The model input with special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ae=new ce({props:{name:"get_special_tokens_mask",anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; List of IDs.",name:"token_ids_0"},{anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014; Optional second list of IDs for sequence pairs.",name:"token_ids_1"},{anchor:"transformers.CpmAntTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/tokenization_cpmant.py#L253",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Me=new rt({}),Pe=new ce({props:{name:"class transformers.CpmAntModel",anchor:"transformers.CpmAntModel",parameters:[{name:"config",val:": CpmAntConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/modeling_cpmant.py#L604"}}),xe=new ce({props:{name:"forward",anchor:"transformers.CpmAntModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, seq_len)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>CPMAntTokenizer</code>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.CpmAntModel.forward.past_key_values",description:`<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>) &#x2014;
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.`,name:"past_key_values"},{anchor:"transformers.CpmAntModel.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.CpmAntModel.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.`,name:"output_attentions"},{anchor:"transformers.CpmAntModel.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.`,name:"output_hidden_states"},{anchor:"transformers.CpmAntModel.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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/modeling_cpmant.py#L642",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</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/v4.29.0/en/model_doc/cpmant#transformers.CpmAntConfig"
>CpmAntConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</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>) \u2014 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>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new Ps({props:{$$slots:{default:[Os]},$$scope:{ctx:E}}}),te=new In({props:{anchor:"transformers.CpmAntModel.forward.example",$$slots:{default:[js]},$$scope:{ctx:E}}}),qe=new rt({}),Le=new ce({props:{name:"class transformers.CpmAntForCausalLM",anchor:"transformers.CpmAntForCausalLM",parameters:[{name:"config",val:": CpmAntConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/modeling_cpmant.py#L751"}}),je=new ce({props:{name:"forward",anchor:"transformers.CpmAntForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Union[typing.List[typing.Tuple[torch.Tensor, torch.Tensor]], NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CpmAntForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, seq_len)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>CPMAntTokenizer</code>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.CpmAntForCausalLM.forward.past_key_values",description:`<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>) &#x2014;
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.`,name:"past_key_values"},{anchor:"transformers.CpmAntForCausalLM.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.CpmAntForCausalLM.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.`,name:"output_attentions"},{anchor:"transformers.CpmAntForCausalLM.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.`,name:"output_hidden_states"},{anchor:"transformers.CpmAntForCausalLM.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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>Args &#x2014;
input_ids (<code>torch.Tensor</code> of shape <code>(batch_size, seq_len)</code>):
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>CPMAntTokenizer</code>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>
past_key_values (<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>):
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the
cross-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.
use_cache (<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>).
output_attentions (<code>bool</code>, <em>optional</em>):
Whether or not to return the attentions tensors of all attention layers.
output_hidden_states (<code>bool</code>, <em>optional</em>):
Whether or not to return the hidden states of all layers.
labels (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss.
return_dict (<code>bool</code>, <em>optional</em>):
Whether or not to return a <a href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.
attention_mask (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
CPMAnt will process attention mask automatically, this parameter is a dummy parameter for
text-generation pipeline.</p>
<p>Example &#x2014;`,name:"return_dict"},{anchor:"transformers.CpmAntForCausalLM.forward.Text",description:"<strong>Text</strong> Generation with CpmAntForCausalLM. &#x2014;",name:"Text"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/cpmant/modeling_cpmant.py#L764",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/en/model_doc/cpmant#transformers.CpmAntConfig"
>CpmAntConfig</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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Ps({props:{$$slots:{default:[Is]},$$scope:{ctx:E}}}),se=new In({props:{anchor:"transformers.CpmAntForCausalLM.forward.example",$$slots:{default:[Ds]},$$scope:{ctx:E}}}),{c(){c=n("meta"),b=p(),_=n("h1"),u=n("a"),v=n("span"),k(l.$$.fragment),f=p(),L=n("span"),Yt=a("CPMAnt"),Mt=p(),I=n("h2"),J=n("a"),at=n("span"),k(pe.$$.fragment),Zt=p(),it=n("span"),eo=a("Overview"),Pt=p(),me=n("p"),to=a("CPM-Ant is an open-source Chinese pre-trained language model (PLM) with 10B parameters. It is also the first milestone of the live training process of CPM-Live. The training process is cost-effective and environment-friendly. CPM-Ant also achieves promising results with delta tuning on the CUGE benchmark. Besides the full model, we also provide various compressed versions to meet the requirements of different hardware configurations. "),he=n("a"),oo=a("See more"),zt=p(),Ne=n("p"),no=a("Tips:"),Et=p(),F=n("p"),so=a("This model was contributed by "),ue=n("a"),ro=a("OpenBMB"),ao=a(". The original code can be found "),fe=n("a"),io=a("here"),lo=a("."),xt=p(),Be=n("p"),co=a("\u2699\uFE0F Training & Inference"),qt=p(),Se=n("ul"),ge=n("li"),po=a("A tutorial on "),_e=n("a"),mo=a("CPM-Live"),ho=a("."),Lt=p(),D=n("h2"),K=n("a"),lt=n("span"),k(ve.$$.fragment),uo=p(),dt=n("span"),fo=a("CpmAntConfig"),Ft=p(),M=n("div"),k(be.$$.fragment),go=p(),N=n("p"),_o=a("This is the configuration class to store the configuration of a "),We=n("a"),vo=a("CpmAntModel"),bo=a(`. It is used to instantiate an
CPMAnt 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 CPMAnt
`),ke=n("a"),ko=a("openbmb/cpm-ant-10b"),Co=a(" architecture."),$o=p(),B=n("p"),wo=a("Configuration objects inherit from "),He=n("a"),yo=a("PretrainedConfig"),Ao=a(` and can be used to control the model outputs. Read the
documentation from `),Ue=n("a"),To=a("PretrainedConfig"),Mo=a(" for more information."),Po=p(),k(Q.$$.fragment),Ot=p(),S=n("h2"),X=n("a"),ct=n("span"),k(Ce.$$.fragment),zo=p(),pt=n("span"),Eo=a("CpmAntTokenizer"),jt=p(),P=n("div"),k($e.$$.fragment),xo=p(),mt=n("p"),qo=a("Construct a CPMAnt tokenizer. Based on byte-level Byte-Pair-Encoding."),Lo=p(),O=n("div"),k(we.$$.fragment),Fo=p(),ht=n("p"),Oo=a(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CPMAnt sequence has the following format:`),jo=p(),ut=n("ul"),ye=n("li"),Io=a("single sequence: "),ft=n("code"),Do=a("[BOS] Sequence"),No=a("."),Bo=p(),Y=n("div"),k(Ae.$$.fragment),So=p(),Te=n("p"),Wo=a(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),gt=n("code"),Ho=a("prepare_for_model"),Uo=a(" method."),It=p(),W=n("h2"),Z=n("a"),_t=n("span"),k(Me.$$.fragment),Vo=p(),vt=n("span"),Ro=a("CpmAntModel"),Dt=p(),z=n("div"),k(Pe.$$.fragment),Go=p(),ze=n("p"),Jo=a(`The bare CPMAnt Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ee=n("a"),Ko=a("torch.nn.Module"),Qo=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xo=p(),H=n("p"),Yo=a(`Parameters
config (`),Ve=n("a"),Zo=a("~CpmAntConfig"),en=a(`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Re=n("a"),tn=a("from_pretrained()"),on=a(" method to load the model weights."),nn=p(),x=n("div"),k(xe.$$.fragment),sn=p(),U=n("p"),rn=a("The "),Ge=n("a"),an=a("CpmAntModel"),ln=a(" forward method, overrides the "),bt=n("code"),dn=a("__call__"),cn=a(" special method."),pn=p(),k(ee.$$.fragment),mn=p(),k(te.$$.fragment),Nt=p(),V=n("h2"),oe=n("a"),kt=n("span"),k(qe.$$.fragment),hn=p(),Ct=n("span"),un=a("CpmAntForCausalLM"),Bt=p(),T=n("div"),k(Le.$$.fragment),fn=p(),$t=n("p"),gn=a("The CPMAnt Model with a language modeling head on top (linear layer with weights tied to the input embeddings)."),_n=p(),Fe=n("p"),vn=a("This model is a PyTorch "),Oe=n("a"),bn=a("torch.nn.Module"),kn=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Cn=p(),R=n("p"),$n=a(`Parameters
config (`),Je=n("a"),wn=a("~CpmAntConfig"),yn=a(`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Ke=n("a"),An=a("from_pretrained()"),Tn=a(" method to load the model weights."),Mn=p(),q=n("div"),k(je.$$.fragment),Pn=p(),G=n("p"),zn=a("The "),Qe=n("a"),En=a("CpmAntForCausalLM"),xn=a(" forward method, overrides the "),wt=n("code"),qn=a("__call__"),Ln=a(" special method."),Fn=p(),k(ne.$$.fragment),On=p(),k(se.$$.fragment),this.h()},l(t){const h=qs('[data-svelte="svelte-1phssyn"]',document.head);c=s(h,"META",{name:!0,content:!0}),h.forEach(o),b=m(t),_=s(t,"H1",{class:!0});var Ie=r(_);u=s(Ie,"A",{id:!0,class:!0,href:!0});var yt=r(u);v=s(yt,"SPAN",{});var At=r(v);C(l.$$.fragment,At),At.forEach(o),yt.forEach(o),f=m(Ie),L=s(Ie,"SPAN",{});var Tt=r(L);Yt=i(Tt,"CPMAnt"),Tt.forEach(o),Ie.forEach(o),Mt=m(t),I=s(t,"H2",{class:!0});var De=r(I);J=s(De,"A",{id:!0,class:!0,href:!0});var Bn=r(J);at=s(Bn,"SPAN",{});var Sn=r(at);C(pe.$$.fragment,Sn),Sn.forEach(o),Bn.forEach(o),Zt=m(De),it=s(De,"SPAN",{});var Wn=r(it);eo=i(Wn,"Overview"),Wn.forEach(o),De.forEach(o),Pt=m(t),me=s(t,"P",{});var jn=r(me);to=i(jn,"CPM-Ant is an open-source Chinese pre-trained language model (PLM) with 10B parameters. It is also the first milestone of the live training process of CPM-Live. The training process is cost-effective and environment-friendly. CPM-Ant also achieves promising results with delta tuning on the CUGE benchmark. Besides the full model, we also provide various compressed versions to meet the requirements of different hardware configurations. "),he=s(jn,"A",{href:!0,rel:!0});var Hn=r(he);oo=i(Hn,"See more"),Hn.forEach(o),jn.forEach(o),zt=m(t),Ne=s(t,"P",{});var Un=r(Ne);no=i(Un,"Tips:"),Un.forEach(o),Et=m(t),F=s(t,"P",{});var Xe=r(F);so=i(Xe,"This model was contributed by "),ue=s(Xe,"A",{href:!0,rel:!0});var Vn=r(ue);ro=i(Vn,"OpenBMB"),Vn.forEach(o),ao=i(Xe,". The original code can be found "),fe=s(Xe,"A",{href:!0,rel:!0});var Rn=r(fe);io=i(Rn,"here"),Rn.forEach(o),lo=i(Xe,"."),Xe.forEach(o),xt=m(t),Be=s(t,"P",{});var Gn=r(Be);co=i(Gn,"\u2699\uFE0F Training & Inference"),Gn.forEach(o),qt=m(t),Se=s(t,"UL",{});var Jn=r(Se);ge=s(Jn,"LI",{});var Wt=r(ge);po=i(Wt,"A tutorial on "),_e=s(Wt,"A",{href:!0,rel:!0});var Kn=r(_e);mo=i(Kn,"CPM-Live"),Kn.forEach(o),ho=i(Wt,"."),Wt.forEach(o),Jn.forEach(o),Lt=m(t),D=s(t,"H2",{class:!0});var Ht=r(D);K=s(Ht,"A",{id:!0,class:!0,href:!0});var Qn=r(K);lt=s(Qn,"SPAN",{});var Xn=r(lt);C(ve.$$.fragment,Xn),Xn.forEach(o),Qn.forEach(o),uo=m(Ht),dt=s(Ht,"SPAN",{});var Yn=r(dt);fo=i(Yn,"CpmAntConfig"),Yn.forEach(o),Ht.forEach(o),Ft=m(t),M=s(t,"DIV",{class:!0});var re=r(M);C(be.$$.fragment,re),go=m(re),N=s(re,"P",{});var Ye=r(N);_o=i(Ye,"This is the configuration class to store the configuration of a "),We=s(Ye,"A",{href:!0});var Zn=r(We);vo=i(Zn,"CpmAntModel"),Zn.forEach(o),bo=i(Ye,`. It is used to instantiate an
CPMAnt 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 CPMAnt
`),ke=s(Ye,"A",{href:!0,rel:!0});var es=r(ke);ko=i(es,"openbmb/cpm-ant-10b"),es.forEach(o),Co=i(Ye," architecture."),Ye.forEach(o),$o=m(re),B=s(re,"P",{});var Ze=r(B);wo=i(Ze,"Configuration objects inherit from "),He=s(Ze,"A",{href:!0});var ts=r(He);yo=i(ts,"PretrainedConfig"),ts.forEach(o),Ao=i(Ze,` and can be used to control the model outputs. Read the
documentation from `),Ue=s(Ze,"A",{href:!0});var os=r(Ue);To=i(os,"PretrainedConfig"),os.forEach(o),Mo=i(Ze," for more information."),Ze.forEach(o),Po=m(re),C(Q.$$.fragment,re),re.forEach(o),Ot=m(t),S=s(t,"H2",{class:!0});var Ut=r(S);X=s(Ut,"A",{id:!0,class:!0,href:!0});var ns=r(X);ct=s(ns,"SPAN",{});var ss=r(ct);C(Ce.$$.fragment,ss),ss.forEach(o),ns.forEach(o),zo=m(Ut),pt=s(Ut,"SPAN",{});var rs=r(pt);Eo=i(rs,"CpmAntTokenizer"),rs.forEach(o),Ut.forEach(o),jt=m(t),P=s(t,"DIV",{class:!0});var ae=r(P);C($e.$$.fragment,ae),xo=m(ae),mt=s(ae,"P",{});var as=r(mt);qo=i(as,"Construct a CPMAnt tokenizer. Based on byte-level Byte-Pair-Encoding."),as.forEach(o),Lo=m(ae),O=s(ae,"DIV",{class:!0});var et=r(O);C(we.$$.fragment,et),Fo=m(et),ht=s(et,"P",{});var is=r(ht);Oo=i(is,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CPMAnt sequence has the following format:`),is.forEach(o),jo=m(et),ut=s(et,"UL",{});var ls=r(ut);ye=s(ls,"LI",{});var Vt=r(ye);Io=i(Vt,"single sequence: "),ft=s(Vt,"CODE",{});var ds=r(ft);Do=i(ds,"[BOS] Sequence"),ds.forEach(o),No=i(Vt,"."),Vt.forEach(o),ls.forEach(o),et.forEach(o),Bo=m(ae),Y=s(ae,"DIV",{class:!0});var Rt=r(Y);C(Ae.$$.fragment,Rt),So=m(Rt),Te=s(Rt,"P",{});var Gt=r(Te);Wo=i(Gt,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),gt=s(Gt,"CODE",{});var cs=r(gt);Ho=i(cs,"prepare_for_model"),cs.forEach(o),Uo=i(Gt," method."),Gt.forEach(o),Rt.forEach(o),ae.forEach(o),It=m(t),W=s(t,"H2",{class:!0});var Jt=r(W);Z=s(Jt,"A",{id:!0,class:!0,href:!0});var ps=r(Z);_t=s(ps,"SPAN",{});var ms=r(_t);C(Me.$$.fragment,ms),ms.forEach(o),ps.forEach(o),Vo=m(Jt),vt=s(Jt,"SPAN",{});var hs=r(vt);Ro=i(hs,"CpmAntModel"),hs.forEach(o),Jt.forEach(o),Dt=m(t),z=s(t,"DIV",{class:!0});var ie=r(z);C(Pe.$$.fragment,ie),Go=m(ie),ze=s(ie,"P",{});var Kt=r(ze);Jo=i(Kt,`The bare CPMAnt Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ee=s(Kt,"A",{href:!0,rel:!0});var us=r(Ee);Ko=i(us,"torch.nn.Module"),us.forEach(o),Qo=i(Kt,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Kt.forEach(o),Xo=m(ie),H=s(ie,"P",{});var tt=r(H);Yo=i(tt,`Parameters
config (`),Ve=s(tt,"A",{href:!0});var fs=r(Ve);Zo=i(fs,"~CpmAntConfig"),fs.forEach(o),en=i(tt,`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Re=s(tt,"A",{href:!0});var gs=r(Re);tn=i(gs,"from_pretrained()"),gs.forEach(o),on=i(tt," method to load the model weights."),tt.forEach(o),nn=m(ie),x=s(ie,"DIV",{class:!0});var le=r(x);C(xe.$$.fragment,le),sn=m(le),U=s(le,"P",{});var ot=r(U);rn=i(ot,"The "),Ge=s(ot,"A",{href:!0});var _s=r(Ge);an=i(_s,"CpmAntModel"),_s.forEach(o),ln=i(ot," forward method, overrides the "),bt=s(ot,"CODE",{});var vs=r(bt);dn=i(vs,"__call__"),vs.forEach(o),cn=i(ot," special method."),ot.forEach(o),pn=m(le),C(ee.$$.fragment,le),mn=m(le),C(te.$$.fragment,le),le.forEach(o),ie.forEach(o),Nt=m(t),V=s(t,"H2",{class:!0});var Qt=r(V);oe=s(Qt,"A",{id:!0,class:!0,href:!0});var bs=r(oe);kt=s(bs,"SPAN",{});var ks=r(kt);C(qe.$$.fragment,ks),ks.forEach(o),bs.forEach(o),hn=m(Qt),Ct=s(Qt,"SPAN",{});var Cs=r(Ct);un=i(Cs,"CpmAntForCausalLM"),Cs.forEach(o),Qt.forEach(o),Bt=m(t),T=s(t,"DIV",{class:!0});var j=r(T);C(Le.$$.fragment,j),fn=m(j),$t=s(j,"P",{});var $s=r($t);gn=i($s,"The CPMAnt Model with a language modeling head on top (linear layer with weights tied to the input embeddings)."),$s.forEach(o),_n=m(j),Fe=s(j,"P",{});var Xt=r(Fe);vn=i(Xt,"This model is a PyTorch "),Oe=s(Xt,"A",{href:!0,rel:!0});var ws=r(Oe);bn=i(ws,"torch.nn.Module"),ws.forEach(o),kn=i(Xt,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xt.forEach(o),Cn=m(j),R=s(j,"P",{});var nt=r(R);$n=i(nt,`Parameters
config (`),Je=s(nt,"A",{href:!0});var ys=r(Je);wn=i(ys,"~CpmAntConfig"),ys.forEach(o),yn=i(nt,`): Model configuration class with all the parameters of the
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the `),Ke=s(nt,"A",{href:!0});var As=r(Ke);An=i(As,"from_pretrained()"),As.forEach(o),Tn=i(nt," method to load the model weights."),nt.forEach(o),Mn=m(j),q=s(j,"DIV",{class:!0});var de=r(q);C(je.$$.fragment,de),Pn=m(de),G=s(de,"P",{});var st=r(G);zn=i(st,"The "),Qe=s(st,"A",{href:!0});var Ts=r(Qe);En=i(Ts,"CpmAntForCausalLM"),Ts.forEach(o),xn=i(st," forward method, overrides the "),wt=s(st,"CODE",{});var Ms=r(wt);qn=i(Ms,"__call__"),Ms.forEach(o),Ln=i(st," special method."),st.forEach(o),Fn=m(de),C(ne.$$.fragment,de),On=m(de),C(se.$$.fragment,de),de.forEach(o),j.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Bs)),d(u,"id","cpmant"),d(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(u,"href","#cpmant"),d(_,"class","relative group"),d(J,"id","overview"),d(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(J,"href","#overview"),d(I,"class","relative group"),d(he,"href","https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live"),d(he,"rel","nofollow"),d(ue,"href","https://huggingface.co/openbmb"),d(ue,"rel","nofollow"),d(fe,"href","https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live"),d(fe,"rel","nofollow"),d(_e,"href","https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live"),d(_e,"rel","nofollow"),d(K,"id","transformers.CpmAntConfig"),d(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(K,"href","#transformers.CpmAntConfig"),d(D,"class","relative group"),d(We,"href","/docs/transformers/v4.29.0/en/model_doc/cpmant#transformers.CpmAntModel"),d(ke,"href","https://huggingface.co/openbmb/cpm-ant-10b"),d(ke,"rel","nofollow"),d(He,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ue,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(X,"id","transformers.CpmAntTokenizer"),d(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(X,"href","#transformers.CpmAntTokenizer"),d(S,"class","relative group"),d(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"id","transformers.CpmAntModel"),d(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Z,"href","#transformers.CpmAntModel"),d(W,"class","relative group"),d(Ee,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Ee,"rel","nofollow"),d(Ve,"href","/docs/transformers/v4.29.0/en/model_doc/cpmant#transformers.CpmAntConfig"),d(Re,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),d(Ge,"href","/docs/transformers/v4.29.0/en/model_doc/cpmant#transformers.CpmAntModel"),d(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(oe,"id","transformers.CpmAntForCausalLM"),d(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(oe,"href","#transformers.CpmAntForCausalLM"),d(V,"class","relative group"),d(Oe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Oe,"rel","nofollow"),d(Je,"href","/docs/transformers/v4.29.0/en/model_doc/cpmant#transformers.CpmAntConfig"),d(Ke,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained"),d(Qe,"href","/docs/transformers/v4.29.0/en/model_doc/cpmant#transformers.CpmAntForCausalLM"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,h){e(document.head,c),g(t,b,h),g(t,_,h),e(_,u),e(u,v),$(l,v,null),e(_,f),e(_,L),e(L,Yt),g(t,Mt,h),g(t,I,h),e(I,J),e(J,at),$(pe,at,null),e(I,Zt),e(I,it),e(it,eo),g(t,Pt,h),g(t,me,h),e(me,to),e(me,he),e(he,oo),g(t,zt,h),g(t,Ne,h),e(Ne,no),g(t,Et,h),g(t,F,h),e(F,so),e(F,ue),e(ue,ro),e(F,ao),e(F,fe),e(fe,io),e(F,lo),g(t,xt,h),g(t,Be,h),e(Be,co),g(t,qt,h),g(t,Se,h),e(Se,ge),e(ge,po),e(ge,_e),e(_e,mo),e(ge,ho),g(t,Lt,h),g(t,D,h),e(D,K),e(K,lt),$(ve,lt,null),e(D,uo),e(D,dt),e(dt,fo),g(t,Ft,h),g(t,M,h),$(be,M,null),e(M,go),e(M,N),e(N,_o),e(N,We),e(We,vo),e(N,bo),e(N,ke),e(ke,ko),e(N,Co),e(M,$o),e(M,B),e(B,wo),e(B,He),e(He,yo),e(B,Ao),e(B,Ue),e(Ue,To),e(B,Mo),e(M,Po),$(Q,M,null),g(t,Ot,h),g(t,S,h),e(S,X),e(X,ct),$(Ce,ct,null),e(S,zo),e(S,pt),e(pt,Eo),g(t,jt,h),g(t,P,h),$($e,P,null),e(P,xo),e(P,mt),e(mt,qo),e(P,Lo),e(P,O),$(we,O,null),e(O,Fo),e(O,ht),e(ht,Oo),e(O,jo),e(O,ut),e(ut,ye),e(ye,Io),e(ye,ft),e(ft,Do),e(ye,No),e(P,Bo),e(P,Y),$(Ae,Y,null),e(Y,So),e(Y,Te),e(Te,Wo),e(Te,gt),e(gt,Ho),e(Te,Uo),g(t,It,h),g(t,W,h),e(W,Z),e(Z,_t),$(Me,_t,null),e(W,Vo),e(W,vt),e(vt,Ro),g(t,Dt,h),g(t,z,h),$(Pe,z,null),e(z,Go),e(z,ze),e(ze,Jo),e(ze,Ee),e(Ee,Ko),e(ze,Qo),e(z,Xo),e(z,H),e(H,Yo),e(H,Ve),e(Ve,Zo),e(H,en),e(H,Re),e(Re,tn),e(H,on),e(z,nn),e(z,x),$(xe,x,null),e(x,sn),e(x,U),e(U,rn),e(U,Ge),e(Ge,an),e(U,ln),e(U,bt),e(bt,dn),e(U,cn),e(x,pn),$(ee,x,null),e(x,mn),$(te,x,null),g(t,Nt,h),g(t,V,h),e(V,oe),e(oe,kt),$(qe,kt,null),e(V,hn),e(V,Ct),e(Ct,un),g(t,Bt,h),g(t,T,h),$(Le,T,null),e(T,fn),e(T,$t),e($t,gn),e(T,_n),e(T,Fe),e(Fe,vn),e(Fe,Oe),e(Oe,bn),e(Fe,kn),e(T,Cn),e(T,R),e(R,$n),e(R,Je),e(Je,wn),e(R,yn),e(R,Ke),e(Ke,An),e(R,Tn),e(T,Mn),e(T,q),$(je,q,null),e(q,Pn),e(q,G),e(G,zn),e(G,Qe),e(Qe,En),e(G,xn),e(G,wt),e(wt,qn),e(G,Ln),e(q,Fn),$(ne,q,null),e(q,On),$(se,q,null),St=!0},p(t,[h]){const Ie={};h&2&&(Ie.$$scope={dirty:h,ctx:t}),Q.$set(Ie);const yt={};h&2&&(yt.$$scope={dirty:h,ctx:t}),ee.$set(yt);const At={};h&2&&(At.$$scope={dirty:h,ctx:t}),te.$set(At);const Tt={};h&2&&(Tt.$$scope={dirty:h,ctx:t}),ne.$set(Tt);const De={};h&2&&(De.$$scope={dirty:h,ctx:t}),se.$set(De)},i(t){St||(w(l.$$.fragment,t),w(pe.$$.fragment,t),w(ve.$$.fragment,t),w(be.$$.fragment,t),w(Q.$$.fragment,t),w(Ce.$$.fragment,t),w($e.$$.fragment,t),w(we.$$.fragment,t),w(Ae.$$.fragment,t),w(Me.$$.fragment,t),w(Pe.$$.fragment,t),w(xe.$$.fragment,t),w(ee.$$.fragment,t),w(te.$$.fragment,t),w(qe.$$.fragment,t),w(Le.$$.fragment,t),w(je.$$.fragment,t),w(ne.$$.fragment,t),w(se.$$.fragment,t),St=!0)},o(t){y(l.$$.fragment,t),y(pe.$$.fragment,t),y(ve.$$.fragment,t),y(be.$$.fragment,t),y(Q.$$.fragment,t),y(Ce.$$.fragment,t),y($e.$$.fragment,t),y(we.$$.fragment,t),y(Ae.$$.fragment,t),y(Me.$$.fragment,t),y(Pe.$$.fragment,t),y(xe.$$.fragment,t),y(ee.$$.fragment,t),y(te.$$.fragment,t),y(qe.$$.fragment,t),y(Le.$$.fragment,t),y(je.$$.fragment,t),y(ne.$$.fragment,t),y(se.$$.fragment,t),St=!1},d(t){o(c),t&&o(b),t&&o(_),A(l),t&&o(Mt),t&&o(I),A(pe),t&&o(Pt),t&&o(me),t&&o(zt),t&&o(Ne),t&&o(Et),t&&o(F),t&&o(xt),t&&o(Be),t&&o(qt),t&&o(Se),t&&o(Lt),t&&o(D),A(ve),t&&o(Ft),t&&o(M),A(be),A(Q),t&&o(Ot),t&&o(S),A(Ce),t&&o(jt),t&&o(P),A($e),A(we),A(Ae),t&&o(It),t&&o(W),A(Me),t&&o(Dt),t&&o(z),A(Pe),A(xe),A(ee),A(te),t&&o(Nt),t&&o(V),A(qe),t&&o(Bt),t&&o(T),A(Le),A(je),A(ne),A(se)}}}const Bs={local:"cpmant",sections:[{local:"overview",title:"Overview"},{local:"transformers.CpmAntConfig",title:"CpmAntConfig"},{local:"transformers.CpmAntTokenizer",title:"CpmAntTokenizer"},{local:"transformers.CpmAntModel",title:"CpmAntModel"},{local:"transformers.CpmAntForCausalLM",title:"CpmAntForCausalLM"}],title:"CPMAnt"};function Ss(E){return Ls(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Js extends zs{constructor(c){super();Es(this,c,Ss,Ns,xs,{})}}export{Js as default,Bs as metadata};
